Skip to main content
Participant
June 15, 2025
Question

Possible to code around markers placed on layer when placed as Motion Graphics?

  • June 15, 2025
  • 2 replies
  • 154 views

I'm trying to create a lap timer in After effects that will show the current lap time, the best lap time prior to the current time in the video, and the last lap time current to the prior time.

I'd like to do all of this via markers on the placed graphic in premiere.

-Current time will be calculated based on the time difference from the current place in the animation and the previous marker.
-Last time will calculate the gap between the two previous markers.
-Best time will calculate the least amount of time between two markers, of all marker sets prior to the current marker.

I've been fooling around with expressions, since that seems to be how Adobe lets you code things, and  thisLayer.marker does not seem to allow me to access markers on the placed layer. I've also tried thisProject.marker.numKeys (undefined) and thisComp.

Is this even possible? It would make my life really easy for determining lap times as I can just drag in the graphic in Premier, throw in a bunch of markers, and it'll automatically do all the timing for me and save me from having to edit anything manually.

2 replies

Dan Ebberts
Community Expert
Community Expert
June 16, 2025

I'm late to the conversation, and don't know much about Premiere, but if I was going to knock something out in AE, it would be text expression like this, where layer markers delineate the completion of each lap:

cur = last = best = null;
m = marker;
n = 0;
if(m.numKeys > 0){
  n = m.nearestKey(time).index;
  if (time < m.key(n).time) n--;
}
if (n > 0){
  cur = time - m.key(n).time;
}if (n > 1){
  last = m.key(n).time - m.key(n-1).time;
  best = last;
  for (i = 1; i <= n-1; i++){
    temp = m.key(i+1).time - m.key(i).time;
    best = Math.min(best,temp);
  }
}
(best == null ? "" : best.toFixed(1)) + "\r" +
(last == null ? "" : last.toFixed(1)) + "\r" +
(cur == null ? "" : cur.toFixed(1))

The best, last, and current times are displayed top to bottom.

Community Expert
June 15, 2025

You can create a timer that looks a composition markers with this expression:

tMin = thisComp.marker.key(1).time;
tMax = thisComp.marker.key(2).time;
value1 = thisComp.marker.key(2).time;
value2 = thisComp.marker.key(1).time;
et = tMax - linear(time, tMin, tMax, value1, value2);
d = 100;
t = Math.round(et*d)/d;
t.toFixed(2);

You could add Sliders to give you a start and end time instead of using Comp Markers. 

 

I don't know of any way for an expression in a MOGRT to read markers added to a clip in Premiere Pro. I would have to do some research on that.