Expression Copied to Clipboard! 🗂
← Back to Expressions

Trigger Expression on Marker - After Effects Expression

Boilerplate expression to trigger actions with markers

Trigger Expression on Marker

n=0;
if(marker.numKeys>0) {
 n=marker.nearestKey(time).index;
 if(marker.key(n).time>time) {
  n--;
 } if(n==0) {
  value;
 } else {
  t=time-marker.key(n).time; //time since marker
  //Do Stuff
 }
} else {
 value;
}

Copied to Clipboard!
n=0;
if(marker.numKeys>0) { n=marker.nearestKey(time).index; if(marker.key(n).time>time) { n--; } if(n==0) { value; } else { t=time-marker.key(n).time; //time since marker //Do Stuff }
} else { value;
}

How To Use This Expression

Replace ‘//Do Stuff’ with the code to be triggered at a marker.

Example Use

You can trigger keyframed animation from the begining of the layer

valueAtTime(inPoint+t)

More expressions you might like...

Credit