Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Linking Array data to text Animator on reveal text word by word

  • Linking Array data to text Animator on reveal text word by word

  • Otto Tasnadi

    September 28, 2021 at 7:46 am

    Hey,

    I have an array of time values in milliseconds on a text layer named timevalues: [6.297, 461.507, 734.1606, 1613.1759, 2069.2254]

    I have another layer with myText: “Mary has a little Lamb”

    I added an Animator to the text layer. I’ve set the Units To Index, and the Based On to Words.

    So whenever I increase the “Start value” to add a new word to the text reveal as I want to show the text word by word at a specific time.

    I want to use the milliseconds from the array to map the time of revealing the word at the time specified.

    To show up the first word at “6,297” milliseconds, the second word at 461,507 milliseconds and so on…

    Can anybody help me with this script?

    I can’t figure out a way to make it work…

  • Andrei Popa

    September 28, 2021 at 8:31 am

    I am not 100% sure how you want this to work. Do you want only that word to be visible? For example, would “Mary” only be visible between 6 milliseconds and 297 milliseconds and then disappear? And then “had” would appear at 461 milliseconds and disappear at 507 milliseconds?

  • Otto Tasnadi

    September 28, 2021 at 8:40 am

    I want to reveal the text word by word at the specified time.

    I don’t want only one word visible at the specified time.

    I have a sound file and I want to show (reveal) the word when the word is pronounced in the sound file.

  • Andrei Popa

    September 28, 2021 at 9:12 am

    Here is an .aep with what you may want. But looks like the data in your array is a little wrong. You may modify the array in the first row for different time/number of words.

  • Otto Tasnadi

    September 28, 2021 at 9:33 am

    Really cool, Thank you.
    Now I just need to figure out how can I take the array from a text layer.

    It am trying with

    const arr = thisComp.layer(“array”).text.sourceText ;

    or

    var arr = thisComp.layer(“array”).text.sourceText ;

    or

    arr = Array.from(thisComp.layer(“array”).text.sourceText;

  • Otto Tasnadi

    September 28, 2021 at 10:23 am

    I updated it and works 😀


    const string = thisComp.layer(“myarray”).text.sourceText;

    const arr = string.split(‘, ‘);

    arrTime = arr.map(x=>x/1000);

    for( i = 0; i< arrTime.length; i++){

    if (time < arrTime[i]) break;

    }

    i

Viewing 1 - 6 of 6 posts

Log in to reply.

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