Run expression after certain time...

Moderators: Disciple, zlovatt

Post Reply
blindchild
Posts: 14
Joined: February 8th, 2009, 2:19 pm

August 4th, 2010, 7:09 am

Hello All,

I have an after effects project set up where a layers opacity increases when another object passes over it. I have made this work, however I would like the opacity increase to only happen once over a certain length of time:

Eg. time between effect reset = 20 frames
Frame 100 'Object B' passes over 'Object A'...Object A flashes.
Frame 110 'Object B' passes over 'Object A' again....Object A does nothing.
Frame 125 'Object B' passes over 'Object A' yet again...Object A flashes.

How do I create a countdown or timer which works out when the effect should or shouldnt happen?

Thank you in advance...if you need any more information please let me know....

Best,
Dan Ebberts
Posts: 319
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

August 4th, 2010, 9:28 am

It's tricky. When your expression detects that the proximity of the other layer is close enough to cause it to flash, it needs to execute a loop that starts at the layer's in point and moves forward in time, frame-by-frame, until it gets to the current time, recreating (using valueAtTime()) everything that has occured in the past to determine if it should flash now.

Sometimes you can get away with starting at the current frame and moving backwards but I don't think that would work in this case because, for example, if the overlap happens every ten frames, the flash would only happen once. Using the first method, it would happen every other time.


Dan
Post Reply