FORUMS: list search recent posts

rearranging live text

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ryan Dunn
rearranging live text
on Jun 30, 2017 at 11:35:25 pm

First time poster, long time lurker (and appreciator of the wonders to be found here).

I am looking for help with an expression that will take a line of text of varying length and swapping the last half of the text with the first to create a resulting layer of text.

So the master text layer might say…

"ONCE IN A WHILE I'M THINKING OF YOU"

And the second text layer would say…

"I'M THINKING OF YOU ONCE IN A WHILE"

I have some conceptual grasp of getting lengths, indexing, and splitting into strings, but I'm having trouble getting this effect to work.

Thinking ahead, I would also have to account for an odd number of words, and making sure that there is a properly placed space after swapping the text around.

Any help would be much appreciated.

Thank you.

…ryan


Return to posts index

Dan Ebberts
Re: rearranging live text
on Jul 1, 2017 at 12:24:08 am

How does the expression know where to split the text?

Dan



Return to posts index

Ryan Dunn
Re: rearranging live text
on Jul 1, 2017 at 12:46:06 am

Thanks for the quick reply Dan. I would think spaces would work for this purpose.

...ryan


Return to posts index


Dan Ebberts
Re: rearranging live text
on Jul 1, 2017 at 4:08:52 am

Maybe something like this:


sp = value.split(" ");
if (sp.length > 1){
a = b = "";
n = Math.floor(sp.length/2);
for (i = 0; i < sp.length; i++){
if (i < n){
b += sp[i] + " ";
}else{
a += sp[i] + " ";
}
}
a+b
}else
value



Dan



Return to posts index

Ryan Dunn
Re: rearranging live text
on Jul 1, 2017 at 5:02:31 am

This worked like magic, Dan. Wait, WAS it magic?

Once this project I'm working on is public, I will share with you what this handiwork was for.

Much appreciated.

…ryan


Return to posts index

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