Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Well, have you in fact even just tried? The .marker functions are well enough documented even in the online help, rudimentary as it may be on expressions otherwise, and are simple enough to use and your requirement is literally as basic as it gets - looping through the markers, comparing the current time and adding up the text strings when the time is greater than the most recent marker's time. Start here:
Mylenium
Copy link to clipboard
Copied
Hi...
Thanks for replying but I didn't really understand the link you provided because I am new to expressions. I understand that the expression has to loop through the markers but I am cluelesss since I do not know where to begin or even where to add the expression.
Copy link to clipboard
Copied
This expression will display a text layer marker's Comment text. If more than one marker is on the layer the displayed text will change when the new marker is reached.
m = marker;
i = m.nearestKey(time).index;
if (m.nearestKey(time).time > time){ i--;}
if (i < 1) { i = 1};
mrkrName = m.key(i).comment
You could also define m as a marker on another layer by just pointing to the layer with the pickwhip and adding .marker to the variable definition.
Copy link to clipboard
Copied
Oh man... Thank you.
But I actually wanted the text to stay after it appears something like the automatic generated Youtube subtitles.
P.S where do I apply the expression? The "source text"?
Copy link to clipboard
Copied
The text in the markers staus visible until the next marker appears on the layer. That expression is the closest thing you can get to automated subtitles in After Effects.
If you want to put the marker on a Null layer and then apply the marker's contents to a text layer all you have to do is change the first line of the expression.
m = thisComp.layer(index - 1).marker;
i = m.nearestKey(time).index;
if (m.nearestKey(time).time > time){ i--;}
if (i < 1) { i = 1};
mrkrName = m.key(i).comment
As long as the null with the markers is one layer above the text layer this work. This prevents any problems caused by layer names.
What, exactly, are you trying to do?
Copy link to clipboard
Copied
1) add a text animator for the opacity of the text and set the opacity of the animator to 0.
2) for the range selector of the animator set units to "Index" and "Based on" to "Words".
3) if you now increase the "Start" of the range selector one by one, the words will appear one by one
4) apply an expression to the "Start" that increments at each marker by one. You can use this iExpression for that https://mamoworld.com/after-effects-expression/increment-marker-1d
iExpressions is available here
https://aescripts.com/iexpressions/
Copy link to clipboard
Copied
Thank you Mathias...
I already found what I was looking for. I'll add your solution to mine.
One too many expression can't harm, right?