[Scott Green] “I just wondered if maybe there’s an easy way using code possibly to say ‘turn on this layer for 1 frame, then turn it off for 1 frame, etc. etc.’?”
Yes — welcome to expressions. I’ll answer your question here, but you can also get a lot of help in the After Effects Expressions forum [link].
Alt-click the opacity stopwatch for your upper layer, then paste in the following code:
frames = 2;
if (timeToFrames() % (frames*2) < frames) 100 else 0;
This will give you a pattern where the upper layer is on and then off for the number assigned to the “frames” variable. As shown, you’ll get two frames on, then two frames off.
The math goes as follows:
- Get the current time in frames (for example, frame 5)
- Divide that value by “frames” times 2, and return the remainder (in this case, divide 5 by 4, and get a remainder of 1)
- Compare that value against the “frames” value; if it’s lower, return 100% to the Opacity value. If it’s higher, return 0% (and 1 is less than 2, so frame 5 will have an opacity on the upper layer of 100%).
Walter Soyka
Principal & Designer at Keen Live
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
RenderBreak Blog – What I’m thinking when my workstation’s thinking
Creative Cow Forum Host: Live & Stage Events