Forums › Adobe After Effects Expressions › marker to pause and maker to resume keyframed animation?
-
marker to pause and maker to resume keyframed animation?
-
JuanLuis Vich
May 17, 2022 at 7:55 pmhello!
I thought this would be easy, but I can’t get it to work.
Could someone know how to get that, having an animation with keyframes, when a marker is found, that animation is paused, until the next marker, which makes the animation to resume? (and so on in the following pairs of markers?)
thank you very much!
-
Dan Ebberts
May 17, 2022 at 8:42 pmTry this:
m = marker;
acc = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
if (n > 0){
if (n%2){
acc = time - m.key(n).time;
}
for (i = 1; i < n; i += 2){
acc += m.key(i+1).time - m.key(i).time;
}
}
}
valueAtTime(time - acc)
BTW, it does just the opposite (runs the animation between marker pairs) if you change the last line to this:
valueAtTime(acc)
-
JuanLuis Vich
May 17, 2022 at 8:56 pmDan, thank you very much, it works wonderfully!
Log in to reply.