• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

marker duration

Community Beginner ,
Nov 14, 2022 Nov 14, 2022

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?

TOPICS
Expressions , Scripting

Views

521

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 14, 2022 Nov 14, 2022

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 14, 2022 Nov 14, 2022

Copy link to clipboard

Copied

Amazing as always!

Thanks Dan

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 14, 2022 Nov 14, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 14, 2022 Nov 14, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 14, 2022 Nov 14, 2022

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 14, 2022 Nov 14, 2022

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.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 14, 2022 Nov 14, 2022

Copy link to clipboard

Copied

LATEST

Thank you Dan.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines