Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Animate text in by word on markers

  • Animate text in by word on markers

    Posted by Wyatt Kedinger on February 8, 2021 at 10:49 pm

    Hi there! I’m pretty close here, but I can’t seem to get this.

    My end goal is to have text (by word) synchronized with the audio and for each word to animate in incrementally at each marker of the audio layer, starting at the in point of the text layer. I have the markers synchronized already (thanks to a plugin) and also have this expression to the point where it increments the text at each marker.

    I’m stuck at getting the expression to start working from the in point of the text layer (which does not have the markers in it). I’m attempting to have all of the markers in one layer (audio) and then have all of the text layers in the composition set across the duration of specific markers that are synchronized with the audio.

    The issue I’m trying to solve is that the text animates in at the beginning of the audio layer (layer with the markers), despite my best efforts for it to animate wherever the in point is.

    Any help would be appreciated, cheers!

    <pre data-stringify-type=”pre”>/* controls the words fading in at markers of audio layer in (“”) */
    fade = .5;
    m = thisComp.layer(“voiceover 3”).marker;
    n = 0;<pre data-stringify-type=”pre”>if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (time < m.key(n).time) n–;
    }if (textIndex < n){
    0;
    }else if (textIndex == n){
    t = time;
    ease(t,0,fade,100,0);
    }else {
    100;
    }<pre data-stringify-type=”pre”>

    Wyatt Kedinger replied 5 years, 3 months ago 2 Members · 9 Replies
  • 9 Replies
  • Fabrice Leconte

    February 10, 2021 at 1:05 am
    Hello, try this:

    fade = .5;

    m = thisComp.layer('voiceover 3').marker;

    n = 0;

    if (m.numKeys > 0) {

    n = m.nearestKey(time).index;

    if (time < m.key(n).time) {

    n--;

    }

    }

    if (inPoint > m.key(n).time && textIndex < n + 1) {

    t = time;

    ease(t, inPoint, inPoint + fade, 100, 0);

    } else if (textIndex < n) {

    0;

    } else if (textIndex == n) {

    t = time;

    ease(t, m.key(n).time, m.key(n).time + fade, 100, 0);

    } else {

    100;

    }

    https://imgur.com/a/WxqcIRp

    View post on imgur.com

  • Wyatt Kedinger

    February 11, 2021 at 7:52 pm

    Thank you, Fabrice! I seriously appreciate it. However, I’m getting an error when adding it. I should also note that in my text layer, I’m applying it to an Expression Selector based on Words. Is that also where you had put it?

    Sorry about the confusion, thank you!

    https://imgur.com/a/lbvf5Fk

    Error: This property has no keyframe at number 0.}
    ▶if (inPoint > m.key(n).time && textIndex < n + 1) {
    t=time;

    Timeline Markers

  • Fabrice Leconte

    February 11, 2021 at 9:36 pm

    Yes,

    replace:

    if (inPoint > m.key(n).time && textIndex < n + 1) {

    by:

    if (n > 0 && inPoint > m.key(n).time && textIndex < n + 1) {
  • Wyatt Kedinger

    February 11, 2021 at 11:21 pm

    Thank you, Fabrice! The expression in the project file you shared with me gives me a pretty close result to one an iteration I previously tried (below). But, I’m trying to get the text layer to only calculate the markers that are present within the in point and out point of the text layer. The expression below that I wrote (similar to yours) calculates all markers, beginning with the first marker in the layer containing the markers, regardless of where the text layer is positioned. This is where I’m really getting stuck. ?

    <pre data-stringify-type="pre">

    fade = .5;

    m = thisComp.layer("voiceover 3").marker;

    n = 0;

    if (m.numKeys > 0){

    n = m.nearestKey(time).index;

    if (time < m.key(n).time) n--;

    }

    if (textIndex < n){

    0;

    }

    else if (textIndex == n){

    t = time - m.key(n).time;

    ease(t,0,fade,100,0);

    }

    else {

    100;

    }

    Again, I really appreciate your help!

    Cheers!

  • Fabrice Leconte

    February 12, 2021 at 1:33 am

    The idea, is to remove all words before the in point value

    add this expression to the sourceText property

    m = thisComp.layer('voiceover 3').marker;

    arr = value.split(' ');

    n = 1;

    while(m.key(n).time < inPoint){

    arr[n-1]='\u200B';

    n++

    }

    style.setText(arr.join(' '));

  • Wyatt Kedinger

    February 12, 2021 at 1:49 am

    Thanks again, Fabrice!! I think this concept is closer, but it’s basically the reverse of what I’m trying to achieve. I laid this file out in the way I’d try and set up the project. A long audio source with synchronized markers and multiple text layers that animate each word in at the markers that correspond within their duration in the timeline.

  • Fabrice Leconte

    February 12, 2021 at 3:11 am
  • Wyatt Kedinger

    February 12, 2021 at 4:38 am

    Thank you! Unfortunately, these aren’t. But, I’ll keep trying to get it! I seriously appreciate your help. I’ll update the thread here if I’m able to solve it.

    Cheers!

  • Wyatt Kedinger

    February 13, 2021 at 12:57 am

    This is a tough one! I took another crack at it today and couldn’t get it. I comped these up to visualize the end goal. Again, here’s my expression and it is applied to an Expression Selector on my text layer.

    fade = .5;

    m = thisComp.layer("voiceover").marker;

    n = 0;

    if (m.numKeys > 0){

    n = m.nearestKey(time).index;

    if (time < m.key(n).time) n--;

    }

    if (textIndex < n){

    0;

    }

    else if (textIndex == n){

    t = time - m.key(n).time;

    ease(t,0,fade,100,0);

    }

    else {

    100;

    }

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