-
Expression to hold animation
I’m trying out something and already have a manual alternative if this doesn’t work.
I have a layer, with the position animating across the screen. I’m controlling its opacity through another expression and woud like it to freeze in place every time its visible, so that it only moves when the opacity it 0.
I had used Hold keyframes and replaced these with layer markers, but whenever you alter any part of the animation you have to readjust the markers.
I feel like I’m close with trying to base it on valueAtTime, something like:
var pos = value;
for (var i = 0; i<time; i++) {
if (transform.opacity.valueAtTime(time-i) == 100) {
pos = transform.position.valueAtTime(time-i);
break;
} else {
pos = value;
}
}
pos;
AE just crashed on me, so I’m guessing I introduced an infinite loop, although I can’t spot it.