FORUMS: list search recent posts

Separate a text by lines and then add a different animation to each line

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
martin jean-sébastien
Separate a text by lines and then add a different animation to each line
on Jun 30, 2015 at 11:16:31 am

Hello,
I would want to animate a text layer with multiple lines.
I would like that each line has differnet animations : animation 1 for line 1, animation 2 for line 2, etc...
And I would not like to split my text layer in multiple layers, I would like to keep only one text layer....

I tried with the expression selector but i did not succeed.

Any help?

Thanks in advance (and sorry for my english!)


Return to posts index

Dan Ebberts
Re: Separate a text by lines and then add a different animation to each line
on Jun 30, 2015 at 6:04:50 pm

Assuming that your text is point text (not box text) and that your lines are separated by carriage returns, you could do something like this to target specific lines (2nd line in this example):

Enter multi-line text
Add Fill Color Animator
Add Expression Selector
Delete Range Selector
add this expression to Expression Selector Amount property:


delay = .1;
dur = .5;
txt = text.sourceText;
splitTxt = txt.split("\r");

lineIdx = 1;
totalChars = splitTxt[0].length;
lineStartIdx = 1;
while (textIndex > totalChars){
lineIdx++;
lineStartIdx = totalChars+1;
totalChars += splitTxt[lineIdx-1].length;
}

if (lineIdx == 2){
myIndex = textIndex-lineStartIdx;
myDelay = delay*myIndex;
linear(time,inPoint+myDelay,inPoint+myDelay+dur,0,100);
}else
0



Edit lineIdx == 2 to affect a different line.

Dan



Return to posts index

martin jean-sébastien
Re: Separate a text by lines and then add a different animation to each line
on Jun 30, 2015 at 8:09:15 pm

Hello Dan,
Thank you for your answer!
But it does not work for my purpose... I changed a very little bit your code to make one only line appearing :

delay = 0;
dur = .0001;
txt = text.sourceText;
splitTxt = txt.split("\r");

lineIdx = 1;
totalChars = splitTxt[0].length;
lineStartIdx = 1;
while (textIndex > totalChars){
lineIdx++;
lineStartIdx = totalChars+1;
totalChars += splitTxt[lineIdx-1].length;
}

if (lineIdx == 1){
myIndex = textIndex-lineStartIdx;
myDelay = delay*myIndex;
linear(time,inPoint+myDelay,inPoint+myDelay+dur,100,0);
}else
100

But my goal was to duplicate this animator to add another animation to the second line, then duplicate to add a third animation, etc... But when I duplicate and change the "lineIdx == 2", it makes the first animator disappeared, so I cannot stack the animators....

But maybe it is not possible?

Thank you very much for your first post!


Return to posts index


Dan Ebberts
Re: Separate a text by lines and then add a different animation to each line
on Jun 30, 2015 at 8:42:57 pm

Are you duplicating the Animator or the Selector?

It works for me when I duplicate the Animator. If I duplicate the Selector, I have to change the last line of all the expressions except the first one from:

0

to:

selectorValue

Dan



Return to posts index

martin jean-sébastien
Re: Separate a text by lines and then add a different animation to each line
on Jul 1, 2015 at 8:03:00 am

I don't understand because I duplicate the animator but it hides the first one. I uploaded my aep project here :
9007_testscriptstextes02.aep.zip

Thank you!


Return to posts index

Dan Ebberts
Re: Separate a text by lines and then add a different animation to each line
on Jul 1, 2015 at 5:03:23 pm

If both animators are targeting the same property, I think you'd be better off duplicating the selector and changing the last line of the second selector's expression to:

selectorValue

Dan



Return to posts index

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