Page 1 of 1

loop opacity expression?

Posted: October 11th, 2004, 3:12 pm
by sickie
Hi there!

I am trying to write an expression to control the opacity over time. Can anyone help?

Starting from the in point of the layer (at 00.00.00), after 12f opacity goes from 0% - 100% over 5f hold for 25f and opacity reduces from 100% - 0% over 5f and after 12f this cycle will loop for the duration of the layer (which is not fixed). Thanks!

Posted: October 14th, 2004, 3:16 pm
by Dan Ebberts
I think this works:

f1 = 12;
f2 = 5;
f3 = 25;
f4 = 5;
f5 = 12;

fTot = f1+f2+f3+f4+f5;

f = Math.round(time/thisComp.frameDuration)%fTot + 1;

rampOn = linear(f,f1,f1+f2,0,100);
rampOff = linear(f,f1+f2+f3,f1+f2+f3+f4,100,0);
Math.min(rampOn,rampOff)

Dan