View all expressions
Conditional

Trigger Animation with Markers

Starts an animation sequence each time a marker is encountered on a specified layer.


markerLayer = thisLayer;
if (markerLayer){
if (markerLayer.marker.numKeys > 0){
var n = markerLayer.marker.nearestKey(time).index;
if (markerLayer.marker.key(n).time > time) n--;
if (n > 0) {
t = time - markerLayer.marker.key(n).time;
animStart = key(1).time;
animEnd = key(numKeys).time;
animDur = animEnd - animStart;
if (t >= 0 && t <= animDur) {
valueAtTime(animStart + t);}
else if (t > animDur) {
valueAtTime(animEnd); }
else {
valueAtTime(animStart);
}}
else{
value;
}}
else {
value;}}
else {
value;
}

Trigger Animation with Markers

Practical use case

Useful for triggering UI animations on click or hover, like button highlights or tooltips.

Check out similar expressions

Data-driven video workflows for After Effects are easier with Plainly.

a mesh of elegant lines transparent image