-
Trigger keyframed effect with checkbox controller
So, I have a drop shadow effect that animates in and out and I need it to do that several times in a sequence. The composition has many layers, so I’ve linked most of the animated elements to a control layer. My goal was to trigger the animation using a control checkbox.
I tried several things that didn’t work. Then I found this expression but it only partially works and I can’t figure out what’s wrong:
p = thisComp.layer("Controls").effect("Top Shadow")("Checkbox");
if (p.value){
gotit = false;
t = time;
while (t >= 0){
if (! p.valueAtTime(t)){
gotit = true;
break;
}
t -= thisComp.frameDuration;
}
if (gotit) time-t else 0;
}else
0
When I turn the checkbox on, the opacity does begin to fade in. However, instead of fading from 0 to 16% over 20 frames, the opacity slowly rises to 100% over the duration of the entire sequence.
Can anyone help me with this?