Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Automated source text animation based on split

  • Automated source text animation based on split

  • Samik Pal

    April 7, 2021 at 7:18 pm

    Hello experts,

    I have newly started in AE and I came across source text animation.

    I have a requirement where I want to show multiple text on source text keyframe animation. I was wondering instead of writing each text on the keyframe is there a way to automate this.

    For example, I have created two text layers and the empty layer is referring to the data source (text source) and I know how to split them based on a delimiter. Please refer to the screenshot.

    Now, Is there a way for me to tell AE to increase the value dynamically inside word[] in line 3 by +1.

    If possible, I desire the code to return word[0] at 0000; word[1] at 0001 and word[2] at 0002.

    Many thanks in advance.

  • Yoan Boisjoli

    April 7, 2021 at 7:44 pm

    Hi Samik !

    I think you could just have the time rounded to floor in there (if you want a new word every second).

    n = Math.floor(time);

    And just put the “n” variable inside the square brackets.

    Let me know if that makes sense !

  • Samik Pal

    April 7, 2021 at 7:56 pm

    Hello Yoan,

    Thanks for looking into this and I have tried what you suggested but it does not return what I had in my mind. At 0001 I was expecting the code return test2. I expect to see a new word every frame.

    Many thanks again

    t=thisComp.layer("test1-test2-test3").text.sourceText;

    word=t.split("-");

    n = Math.floor(time);

    word[n]

  • Yoan Boisjoli

    April 7, 2021 at 8:02 pm

    Hey Samik! Are you referring to frames or seconds?

  • Yoan Boisjoli

    April 7, 2021 at 8:03 pm

    if you’re referring to frames, try this:

    n = Math.floor(timeToFrames());
  • Samik Pal

    April 7, 2021 at 8:03 pm

    frames

  • Samik Pal

    April 7, 2021 at 8:05 pm

    found it

    t=thisComp.layer("test1-test2-test3").text.sourceText;

    word=t.split("-");

    n = time/thisComp.frameDuration

    word[n]

  • Samik Pal

    April 7, 2021 at 8:13 pm

    Tried with both and both works. mAny thanks for your time Yoan

    t=thisComp.layer("X1-X2-X3-X4").text.sourceText;

    word=t.split("-");

    //n = time/thisComp.frameDuration

    n = Math.floor(timeToFrames());

    word[n]

  • Yoan Boisjoli

    April 7, 2021 at 11:17 pm

    Glad you found by yourself also! And glad I got to help! Have a good day!

Viewing 1 - 9 of 9 posts

Log in to reply.

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