Created
March 7, 2019 21:23
-
-
Save animoplex/fa91659baccbb91b810313053a48c2e9 to your computer and use it in GitHub Desktop.
Loop Animation With Markers - After Effects Expression by Animoplex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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