Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Randomize order for text

  • Randomize order for text

    Posted by Tom Metzler on August 16, 2018 at 4:23 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.

    Tom Metzler replied 8 years, 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Kalleheikki Kannisto

    August 18, 2018 at 11:02 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

  • Tom Metzler

    August 20, 2018 at 12:22 am

    Thank you!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy