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 : )
2 Responses to AFX Preset: Sinful Animation ;p
shankarnag December 2, 2010
how to use offter effect in mediea
Johan Borgström December 3, 2010
Just put the effect preset in the presets folder. (C:\Program Files\Adobe\Adobe After Effects CS5\Support Files\Presets\tsom).
As you see I created a folder called “tsom” where I keep presets that I have written. Then apply the effect using the effect/preset browser. Just type in “tsom” in the searchfield and the effect should appear. Drag and drop the effect on whatever media you want and then connect the property that you want to animate to the output property of the effect. I usually add the effect to a null and then connect multiple properties to the result of the effect.