Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Loop Animation With Markers - After Effects Expression by Animoplex
// Loop Animation With Markers - Created by Animoplex: www.animoplex.com
// Repeat a property's keyframed animation, resetting the loop at the start of every layer marker
// Based loosely on Marker Sync Expression: http://www.motionscript.com/design-guide/marker-sync.html
n = 0;
if (marker.numKeys > 0) {
n = marker.nearestKey(time).index;
if (marker.key(n).time > time) {
n--;
} // get previous marker index
}
if (n == 0) {
value;
} else {
m = marker.key(n); // m is target marker
t = time - m.time; // time since target marker
try {
valueAtTime(key(1).time + t); // play from first keyframe
} catch(err) {
value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.