FORUMS: list search recent posts

Keyframe triggers a fade out

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jeff Bobbington
Keyframe triggers a fade out
on Jan 14, 2016 at 11:08:35 am

Hey all,

I know this is a simple one but I just cant get it to work.

Id like to have the opacity to instantly jump up to 100% when an (unrelated) keyframe on a slider is met, then fade out over 20f. If another keyframe happens to interrupt this fadeout then it should still do the same thing, jump up to 100% and fade out. (over and over again). So the resting opacity should be 0% until keyframes are met, sort of like a flashbulb effect when keyframes are met.


Return to posts index


Dan Ebberts
Re: Keyframe triggers a fade out
on Jan 14, 2016 at 2:50:49 pm

This should work:


fadeTime = framesToTime(20);
s = effect("Slider Control")("Slider");
if (s.numKeys > 0){
n = s.nearestKey(time).index;
if (time < s.key(n).time) n--;
if (n > 0)
linear(time - s.key(n).time,0,fadeTime,100,0)
else
0;
}else
0



Dan



Return to posts index

Jeff Bobbington
Re: Keyframe triggers a fade out
on Jan 14, 2016 at 3:53:04 pm

Perfection as usual Dan!
Greatly appreciated.


Return to posts index


Jeff Bobbington
Re: Keyframe triggers a fade out
on Jan 15, 2016 at 12:57:33 pm

Greatly appreciated!

How could I go about adding 2 variables to this:

A delay time - so instead of triggering on the exact frame, it happens a few frames before or after the keyframe is met.

A fade in duration - so it can take more than 1 frame to go from 0 to 100% opacity.


Return to posts index

Dan Ebberts
Re: Keyframe triggers a fade out
on Jan 15, 2016 at 5:43:49 pm

Maybe like this:


fadeInTime = framesToTime(5);
fadeOutTime = framesToTime(15);
delay = framesToTime(3);

s = effect("Slider Control")("Slider");
if (s.numKeys > 0){
n = s.nearestKey(time).index;
if (time < s.key(n).time) n--;
if (n > 0){
t = time - s.key(n).time - delay;
if (t < fadeInTime)
linear(t,0,fadeInTime,0,100)
else
linear(t,fadeInTime,fadeInTime+fadeOutTime,100,0);
}else{
0;
}
}else
0



Dan



Return to posts index

Jeff Bobbington
Re: Keyframe triggers a fade out
on Jan 18, 2016 at 12:40:38 pm

Very cool!
I have found an issue though.

If I set the delay to a negative number so as to advance the flash effect, it cuts off the fadein effect.
So a delay of -15 together with a fade of 15 results in the fade being completely cut off!



Return to posts index

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