If there isn’t a direct relationship between distance and opacity, you’re
going to need a more complex expression. For example, you may want to trigger a
fade in when you get within a certain distance and trigger a fade out (at a
different rate) when it moves a certain distance away. In that type of
expression, you have to loop back in time, frame-by-frame, to find the most
recent triggering event. It’s hard to say exactly what you need without more
detail though.
Dan
Sent: Wednesday, May 09, 2012 7:42 AM
Subject: [AE] Expressions: Decay after trigger
I
am writing an expression to bring the opacity of a layer up when it another
layer comes close to it. I'd like to have it decay at a different rate than it
builds. Here's what I have going on:
o = transform.opacity;
s =
thisComp.layer("center").transform.scale[0]/100; //use the scale to affect the
radius of influence of the null
l = length(transform.position,
thisComp.layer("center").transform.position);
lprev =
length(transform.position.valueAtTime(time-thisComp.frameDuration),
thisComp.layer("center").transform.position.valueAtTime(time-thisComp.frameDuration));
if(lprev > l){
l = lprev;
}
o - (l/s);
My attempt to look at the previous frame doesn't seem to be working.