Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Amazing as always!
Thanks Dan
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
You'd apply it to Opacity, but you need one or more split (Alt + drag) layer markers for it to do anything.
Copy link to clipboard
Copied
Thanks, Dan. Very useful tool. I'm going to fiddle with the math on a bounce-at-marker preset I created a while ago.
Copy link to clipboard
Copied
It probably needs a little work, depending on what you want to happen if there are no markers or if it encounters a non-split marker. Please post if you come up with something inetersting (or just need another set of eyes to look at something.)
Copy link to clipboard
Copied
Thank you Dan.