Alternate Blinking Layers in After Effects

July 29, 2009

I was looking for a simple way to alternate 2 layers for a simple flapping cape animation.

I came across this expression to set a layer to blink. I figured out how to modify it for the effect I wanted.

Add the following expressions to opacity:

Layer 1

blinkSpeed = 2;

t = (Math.cos (blinkSpeed*time*Math.PI*2)+1)/2;

v = linear(t, 0, 1, 0, 1);

Math.round(v)*100

Layer 1

blinkSpeed = 2;

t = (Math.cos (blinkSpeed*time*Math.PI*2)+1)/2;

v = linear(t, 1, 0, 1, 0);

Math.round(v)*100

Notice the change to the "v=linear" number order.

I'm sure this is out there somewhere but I couldn't find it.

Seems like a useful expression thanks for sharing. Fee like I need to start to using more expressions in my work.
Brad Chmielewski | July 29, 2009
Thanks Brad! Expressions are great in AE. What I figured out today allowed me to create that animation in one composition rather than the three I was previously doing. It really simplifies things. Expressions also allow me to use the analytical side of my brain along with my creative side.
nathan | July 29, 2009
Hi, thanks for sharing this expressions. Do you know what to do If I want to use tree layers?
ema | May 3, 2010
How would I modify this to cycle between 5 layers?
Mike | May 19, 2010
I can't find the RSS button for your blog to subscribe to? Do you have one, or am I just blind?
Eugene Harsha | June 15, 2010
Perfect! I had the same problem as you in that I couldn't find it anywhere... Till now! Many thanks will help me animate this magpie!
Gloucester Video Production- bexmedia | January 18, 2012
Thanks! Glad to help!
nathan | January 18, 2012