-
-
Save maximilliangeorge/8994c77c6625b7214cf4359b9b92c75d to your computer and use it in GitHub Desktop.
Marker Sync - After Effects Expression by Animoplex
This file contains hidden or 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
// MARKER SYNC | |
// | |
// Allows you to trigger playback of precomp segments using markers. | |
// This allows you to change timings without diving into precomps and makes it easier to reason about your project file. | |
// | |
// 1. Create a precomp A with a layer called "Controller" | |
// 2. Add named markers to the timeline within Controller. | |
// 3. In the parent comp, enable Time Remapping for the precomp A | |
// | |
// Modified expression based on Dan Ebbert's Marker Sync Expression | |
// Original Version: http://www.motionscript.com/design-guide/marker-sync.html | |
// Full Tutorial: https://www.youtube.com/watch?v=B_3XS2-VWOM&t=698s | |
src = comp(name).layer("Controller"); | |
n = 0; | |
if (marker.numKeys > 0) { | |
n = marker.nearestKey(time).index; | |
if (marker.key(n).time > time) { | |
n--; | |
} | |
} | |
if (n == 0) { | |
0 | |
} else { | |
m = marker.key(n); | |
myComment = m.comment; | |
t = time - m.time; | |
try { | |
mark = src.marker.key(myComment); | |
if (src.marker.numKeys > mark.index) { | |
tMax = src.marker.key(mark.index + 1).time - mark.time; | |
} else { | |
tMax = src.outPoint - mark.time; | |
} | |
t = Math.min(t, tMax); | |
mark.time + t; | |
}catch (err) { | |
0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment