Last active
August 24, 2023 19:54
-
-
Save animoplex/cecf1c64aec4f2733ecd0edbebf4786d to your computer and use it in GitHub Desktop.
Marker Sync - 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
// Marker Sync Expression | |
// 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("Markers"); | |
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