Skip to main content
PetePLTR
Participating Frequently
November 14, 2022
Question

marker duration

  • November 14, 2022
  • 1 reply
  • 877 views

Hey,

I've been playing around with importing .srt files into After Effects usinf Digital Anarchy's free script found here...

https://digitalanarchy.com/demos/SRT-importer.html

I'm trying to add an expression to an opacity animator on the text layer that types on the words/characters over the duration of the marker from 0% to 100%....

 

m = thisLayer.marker.nearestKey(time);

s = timeToCurrentFormat(m.time)/25;

dur = m.duration;

linear(time, s, s + dur, 0, 100);

 

It starts off okay, but as soon as it detects the next marker it resets to 0.

Is there anyway to keep it going until the end of the marker duration and then reset to 0 at the start of the next marker?

This topic has been closed for replies.

1 reply

Dan Ebberts
Community Expert
Community Expert
November 14, 2022

Try this:

m = marker;
val = 0;
if (m.numKeys > 0){
  n = m.nearestKey(time).index;
  if (time < m.key(n).time) n--;
  if (n > 0){
    dur = m.key(n).duration;
    t = time - m.key(n).time;
    val = linear(t,0,dur,0,100);
  }
}
val
Community Expert
November 14, 2022

I am not sure where that code goes. If I apply it to Opacity or a range selector, it always returns Zero.

 

I can fiddle with it a bit and get it to return the time values of every marker, but I get no animation. A screenshot showing how it is applied or a more complete workflow description would be great. I'm always looking for more ways to implement automated animation based on the layer in/out points and layer markers. I'm always using time instead of the time between markers.

Community Expert
November 14, 2022

You'd apply it to Opacity, but you need one or more split (Alt + drag) layer markers for it to do anything.


Thanks, Dan. Very useful tool. I'm going to fiddle with the math on a bounce-at-marker preset I created a while ago.