Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Generate text from markers

  • Generate text from markers

    Posted by Henri Yates on June 21, 2020 at 4:04 pm

    Hi…
    I’m wondering if there’s an expression to generate text from markers (marker’s comment).

    In this snapshot’s case, I want an expression (or any way) to generate the words from the marker layer (Null 1) so when the CTI reaches the first marker, the first word appears and stays, then the next word until there’s no more markers.
    In short, I want my text layer to be triggered word by word by the markers in the Null layer.
    Can someone tell me what I should do, please?

    Thanks.

    Henri Yates replied 5 years, 10 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    June 21, 2020 at 4:30 pm

    Try this:


    m = thisComp.layer("Null 1").marker;
    txt = "";
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (time < m.key(n).time) n--;
    for (i = 1; i <= n; i++){
    txt += m.key(i).comment + " ";
    }
    }
    txt

    Dan

  • Henri Yates

    June 21, 2020 at 5:06 pm

    It worked…
    Thank you so much.
    Quick last question, please.
    The expression below is supposed to make each word animate in like it is handwritten or typewritten animation (animation like one in video P.S it’s 4 seconds long) 14195_comp1.mp4.zip
    How do you suggest I blend it with the expression you provided so the words come animating in at markers instead of just appearing?

    m = thisComp.layer(1).marker;
    rate = 20;
    n = text.sourceText.length;
    d = n/rate;
    pre = d/2;
    t = time - (m.key(1).time - pre);
    linear(t,0,d,0,100)

  • Dan Ebberts

    June 21, 2020 at 5:32 pm

    Like this maybe:


    rate = 20;
    m = thisComp.layer("Null 1").marker;
    txt = "";
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (time < m.key(n).time) n--;
    for (i = 1; i <= n-1; i++){
    txt += m.key(i).comment + " ";
    }
    if (n > 0){
    curWord = m.key(n).comment;
    if (n < m.numKeys){
    curRate = Math.max(rate,curWord.length/(m.key(n+1).time - m.key(n).time));
    }else{
    curRate = rate;
    }
    t = time - m.key(n).time;
    x = curRate*t;
    txt += curWord.substr(0,x);
    }
    }
    txt

    Dan

  • Henri Yates

    June 21, 2020 at 6:04 pm

    Thank you so so much.
    This is exactly what I been looking for since ’69.
    Thank you and God bless you.

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