Forums › Adobe After Effects Expressions › Trigger Two Keyframes With Alpha – not working
-
Trigger Two Keyframes With Alpha – not working
-
Dan Ebberts
June 19, 2022 at 2:47 pmWhat does your expression, in its final form, look like?
-
Toby Waskowitz
June 19, 2022 at 4:45 pmHere is the final version (there are two keyframes in the scale slider):
N = thisComp.layer(“Controls”).effect(“Scale”)(1)
sampleSize = [1,1];
L = thisComp.layer(“Alpha Scale”);
P = L.fromComp(toComp(anchorPoint));
lum = rgbToHsl(L.sampleImage(P,sampleSize/2,true,time))[2];
t = 0;
t1 = N.key(1).time;
t2 = N.key(N.numKeys).time;
if (lum == 1){
t = thisComp.frameDuration
while ((t < t2 – t1) && t <= time){
lTemp = rgbToHsl(L.sampleImage(P,sampleSize/2,true,time-t))[2];
if (lTemp < 1){
t -= thisComp.frameDuration;
break;
}
t += thisComp.frameDuration;
}
}
v = N.valueAtTime(t1 + t)
value + [v,v,v] -
Dan Ebberts
June 19, 2022 at 9:10 pmI think the easiest way would be to apply the keyframe overshoot expression to the slider and then change this line:
while ((t < t2 - t1) && t <= time){
to this:
while ((t < (t2 - t1)*3) && t <= time){
in the sampleImage() expression.
-
Toby Waskowitz
June 20, 2022 at 9:00 amThat’s just awesome! hehe… I was also thinking the same way, I did apply the overshoot to the slider, but it didn’t work without that new line, but now it’s working flawlessly. I really want to thank you very much for helping me with this.
Log in to reply.