-
Randomize order for text
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.