by Johan Borgström
I was asked to animate a graphic element blinking with the frequency of 1,4 hz. That means that the light needs to blink 1,4 times per second. With a framerate of 25 fps that means that a cycle or 1 wavelength of the animation is 25/1,4 = 17.86 frames. With a repeating animation with a specified frequency like this I found it better to write an expression using a sine wave to describe the animation rather than using keyframes. As a visual explanation of how a sine wave is constructed see the post Unit Circle.
A few weeks later, in another project I needed to animate alot of flashing lights, so I refined the expression and made it to an animation preset. I added some extra attributes to have more control of the sine wave. I promise to post images and animations from the project as soon as possible. It´s looking kinda´nice … : )

freq: is the number of occurrences of a repeating event per unit time.
offset: Offset of the wave. Specified in degrees. A value of 180 shifts the wave half a wavelength.
max: The max value.
min: The min value.
output: the result of the expression. Used to connect to or as a visual reference. To use this preset create a null object and apply the preset to the null. Then connect whatever property you want to the output value. I come to like this approach to setup stuff in afx.
Download
As always, if you have any comments of any kind or ideas on how to improve this workflow let me know. I am always interested in improving my skills : )
tsom_sine (145)