ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Duplicating a source text horizontally a (number) of times

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
ramondo robinson
Duplicating a source text horizontally a (number) of times
on Mar 14, 2019 at 8:49:46 pm

Looking to do a expression that will duplicate a source text horizontally a set amount of times. I need to always have the text maintain the same amount of tracking and for the text/letters to be evenly spaced horizontally no matter the word. Does anyone have any ideas how to go about that expression wise?

exp: b o o m b o o m b o o m b o o m b o o m b o o m

or

exp: s h o o t s h o o t s h o o t s h o o t s h o o t s h o o t s h o o t s h o o t

not:
b o o mb o omb o o mb o om

Thanks!


Return to posts index

Tomas Bumbulevičius
Re: Duplicating a source text horizontally a (number) of times
on Mar 14, 2019 at 9:21:27 pm

Ramondo,

if I understood correctly - try applying the following to the Source Text of the text layer.

Then, either adjust the type through the character panel or apply Text Animator with preferred transformations.

phrase = text.sourceText;
num = 5;

phrase.repeat(num)



Find out more:
After Effects Tutorials: motion design, expressions, scripting.


Return to posts index

ramondo robinson
Re: Duplicating a source text horizontally a (number) of times
on Mar 15, 2019 at 1:58:12 pm

Thanks so much, but it seems phrase.repeat is not being seen as a function...Also it replaces the source text with the number 5.... I assume it is becuase of line 2: num=5; I changed the variable just to check and it updated to that number as well.


Return to posts index


ramondo robinson
Re: Duplicating a source text horizontally a (number) of times
on Mar 15, 2019 at 2:03:55 pm

So maybe I am not clear enough about the objective. I have a text duplicate horizontally...a set amount of times. I need the update the word from time to time so I assume this code would go in the source text area....


Return to posts index

ramondo robinson
Re: Duplicating a source text horizontally a (number) of times
on Mar 15, 2019 at 2:06:14 pm

Typos*
So maybe I am not clear enough about the objective. I need to have a text duplicate horizontally...a set amount of times. I also need to update the word from time to time, so I assume this code would go in the source text area....


Return to posts index

Tomas Bumbulevičius
Re: Duplicating a source text horizontally a (number) of times
on Mar 15, 2019 at 2:49:29 pm

Its either you are using legacy expression engine, or old CC version.

Anyways, try longer expression as below.

1. Apply expression to text's source.
2. Add any text you want into text layer.
3. Change 'num' variable to adjust how many copies to make.

phrase = text.sourceText;
num = 5;

repeatString(phrase, num)

function repeatString(string, repeats) {
newString = "";
while (repeats > 0) {
newString += string;
repeats--;
}
return newString;
}





Find out more:
After Effects Tutorials: motion design, expressions, scripting.


Return to posts index


ramondo robinson
Re: Duplicating a source text horizontally a (number) of times
on Mar 15, 2019 at 2:57:45 pm

That worked!! yeah I have cc 2018....Thanks for the help!


Return to posts index

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