ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Randomize order for text

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Tom Metzler
Randomize order for text
on Aug 16, 2018 at 4:23:49 am
Last Edited By Tom Metzler on Aug 17, 2018 at 6:47:43 am

Hello,
I am trying to find a way to randomize each letter's order in following a specified action under the text animator (in this case, position). Currently, I have an expression that does the same thing except without the order randomization. It uses a slider in order to control the graphing of the movement of each individual letter. It looks like this:


delay = 2;
d = delay*thisComp.frameDuration*(textIndex - 1);
effect("Slider Control")("Slider").valueAtTime(time - d)


I am aware that there is a built-in function that does randomize order (underneath range selector), but if I were to use this then I would not be able to customize the graphing of each individual letter like my expression helps me to do.

The following is the closest that I got to a successful expression, however the issue is that the RNG is based on the iteration through the text.
ie: The letters at the end of the word are more likely to be randomly spaced compared to the ones at the beginning.

delay = 2;
seedRandom(textIndex, true)
i = Math.floor(random(textIndex))
d = delay*thisComp.frameDuration*(i);
effect("Slider Control")("Slider").valueAtTime(time - d)


To solve this, I tried to get the length of the string as a whole, but it wasn't working for some reason.

delay = 2;
L = text.sourceText.length
seedRandom(textIndex, true)
i = Math.floor(random(L))
d = delay*thisComp.frameDuration*(L);
effect("Slider Control")("Slider").valueAtTime(time - d)


Thanks in advance to any help.

EDIT:
I should also specify how to use the original expression at its current state.
After adding an animator on a text, you add an expression selector and paste it in there.
Also "delay" refers to the number of frames delay there is between each different letter doing its animation.


Return to posts index

Kalleheikki Kannisto
Re: Randomize order for text
on Aug 18, 2018 at 11:02:59 am

It was pretty minor. You just have to change "L" to an "i" on line 5
(Missing a bunch of semicolons at the ends of the lines, that may have some effect as well.)

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Tom Metzler
Re: Randomize order for text
on Aug 20, 2018 at 12:22:40 am

Thank you!


Return to posts index

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