ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression for decreasing a value over time after a keyframe is hit?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
William PoorExpression for decreasing a value over time after a keyframe is hit?
by on Aug 31, 2015 at 7:26:19 pm

So here's a fun one. I have a null with a slider on it, and that slider has a bajillion keyframes. I also have a light layer. What I need to happen is: every time there's a slider keyframe of a certain value (say 50), I need the light to change to 100% intensity and then fade back to zero over the course of a second or two. Here's the intensity expression I have so far:

pitch=thisComp.layer("midi").effect("ch_0_pitch")("Slider");
if(pitch==82){[100];}
else{[???];}

I figure the key is in that else{} field...and something involving "value-"...but I'm stumped! Any ideas?

Thanks!


Return to posts index

Kalle KannistoRe: Expression for decreasing a value over time after a keyframe is hit?
by on Sep 1, 2015 at 11:17:21 am
Last Edited By Kalle Kannisto on Sep 1, 2015 at 11:19:23 am

You'll have to check backwards (with a For loop), as far back as the duration of your intended fade, for any frames that are above the threshold value and calculate the light brightness based on how many frames back it fell back below the threshold.

BTW: Trapcode Soundkeys does such fade expressions automatically.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]