ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

expression to show comments and duration between markers :)

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Chifei Soong
expression to show comments and duration between markers :)
on May 25, 2012 at 9:22:15 am

source text expression:
small expression to display duration between markers in layer.
(modified from Dan's marker expression)
------------------------
need help:
now the expressions gets the time from nearest markerKey, need to make the expression hold until the next marker, so that the value wont change half-way between 2 markers
Thanks :D

p=thisLayer; //layer where the markers is

if (p.marker.numKeys > 0) try{
n = p.marker.nearestKey(time).index;
m = p.marker.key(n).time; m2=p.marker.key(n+1).time;
c=p.marker.key(n).comment;
v=m2-m;
}
catch(err){ c=p.marker.key(n).comment; m=0; m2=p.marker.key(n).time; m3=thisComp.duration; v=m3-m2;}

c+"r"+timeToTimecode(v)


Return to posts index

Dan Ebberts
Re: expression to show comments and duration between markers :)
on May 25, 2012 at 4:26:22 pm

I think you're after something like this:



m = thisLayer.marker; //layer where the markers is
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time) n--;
if (n == m.numKeys){ // after last marker
t = thisComp.duration - m.key(n).time;
c = m.key(n).comment;
}else if (n == 0){ // before first marker
t = m.key(1).time;
c = "";
}else{ //between two markers
t = m.key(n+1).time - m.key(n).time;
c = m.key(n).comment;
}
}else{ // no markers
t = thisComp.duration;
c = "";
}

c + "r" + timeToTimecode(t)



(note that the "r" in the last line should be "(backslash)r"


Dan



Return to posts index

Chifei Soong
Re: expression to show comments and duration between markers :)
on May 25, 2012 at 4:54:46 pm

Yes it works perfectly as i wanted.

:) thanks Dan!


Return to posts index


Chifei Soong
Re: expression to show comments and duration between markers :)
on Feb 29, 2020 at 8:42:33 am

Hi Dan
I just wanted to thank you again.
8 years, this script still serving me well 😃


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]