ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Generate text from markers

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Henri Yates
Generate text from markers
on Jun 21, 2020 at 4:04:20 pm

Hi...
I'm wondering if there's an expression to generate text from markers (marker's comment).

In this snapshot's case, I want an expression (or any way) to generate the words from the marker layer (Null 1) so when the CTI reaches the first marker, the first word appears and stays, then the next word until there's no more markers.
In short, I want my text layer to be triggered word by word by the markers in the Null layer.
Can someone tell me what I should do, please?

Thanks.


Return to posts index

Dan Ebberts
Re: Generate text from markers
on Jun 21, 2020 at 4:30:22 pm

Try this:


m = thisComp.layer("Null 1").marker;
txt = "";
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
for (i = 1; i <= n; i++){
txt += m.key(i).comment + " ";
}
}
txt



Dan



Return to posts index

Henri Yates
Re: Generate text from markers
on Jun 21, 2020 at 5:06:16 pm

It worked...
Thank you so much.
Quick last question, please.
The expression below is supposed to make each word animate in like it is handwritten or typewritten animation (animation like one in video P.S it's 4 seconds long) 14195_comp1.mp4.zip
How do you suggest I blend it with the expression you provided so the words come animating in at markers instead of just appearing?

m = thisComp.layer(1).marker;
rate = 20;
n = text.sourceText.length;
d = n/rate;
pre = d/2;
t = time - (m.key(1).time - pre);
linear(t,0,d,0,100)


Return to posts index


Dan Ebberts
Re: Generate text from markers
on Jun 21, 2020 at 5:32:18 pm

Like this maybe:


rate = 20;
m = thisComp.layer("Null 1").marker;
txt = "";
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
for (i = 1; i <= n-1; i++){
txt += m.key(i).comment + " ";
}
if (n > 0){
curWord = m.key(n).comment;
if (n < m.numKeys){
curRate = Math.max(rate,curWord.length/(m.key(n+1).time - m.key(n).time));
}else{
curRate = rate;
}
t = time - m.key(n).time;
x = curRate*t;
txt += curWord.substr(0,x);
}
}
txt



Dan



Return to posts index

Henri Yates
Re: Generate text from markers
on Jun 21, 2020 at 6:04:41 pm

Thank you so so much.
This is exactly what I been looking for since '69.
Thank you and God bless you.


Return to posts index

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