Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Move text layer X pixels on every marker

  • Move text layer X pixels on every marker

    Posted by Stuart Reid on March 14, 2024 at 6:46 pm

    Hi, (very) long time lurker would could really use some help please:
    I have a large amount of text (three paperback pages-worth), the words of which are to appear on-screen as matching narration is spoken. So far, so straightforward. However what is killing me is trying to get the text to shift up in space 1 line at the end of every line, sort of how a typewriter works. I’m trying to work out how I tell AE to move up the text precisely X number of pixels every time a marker is added. So, if my text leading is 26 points, AE knows that at every marker, 26 pixels is added to the text layers Y value. I hope that makes sense, thanks for reading and big thanks to whoever can help.

    Brie Clayton replied 1 year, 1 month ago 4 Members · 9 Replies
  • 9 Replies
  • Dan Ebberts

    March 14, 2024 at 6:57 pm

    I’d start with something like this:

    leading = text.sourceText.style.leading;
    m = marker;
    n = 0;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (time < m.key(n).time) n--;
    }
    y = n*leading;
    value - [0,y]
  • Tom Morton

    March 15, 2024 at 6:56 am

    Have you though of just using the captions tool in Premiere Pro or even the credits roll feature? Both would give you similar effects and they’re built in as standard…

  • Stuart Reid

    March 17, 2024 at 1:22 pm

    No good Tom, it has to be more flexible due to timing of the underlying VO.

  • Stuart Reid

    March 17, 2024 at 1:26 pm

    Thanks Dan, any idea why I’m getting an expression error on value – [0,y] – Error couldn’t return result into numeric value ?

  • Dan Ebberts

    March 17, 2024 at 1:57 pm

    Hmmm… It works fine for me. It’s a position expression. It would complain if you’ve separated dimensions, but I think it would be a different error. Can you post a screen shot showing the expression?

  • Stuart Reid

    March 17, 2024 at 2:33 pm

    Dan, it was me being an idiot and placing the code in Source Text rather than Position and now it works perfectly! May I ask, is it much more complicated to make each line smoothly move up over, say 6 frames? I really appreciate your help.

  • Dan Ebberts

    March 17, 2024 at 3:18 pm

    A little more complicate, but not much:

    easeFrames = 6;
    s = text.sourceText.style;
    leading = s.autoLeading ? s.fontSize*1.2 : s.leading;
    m = marker;
    n = 0;
    y = 0;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (time < m.key(n).time) n--;
    }
    if (n > 0){
    t = time - m.key(n).time;
    easeDur = framesToTime(easeFrames);
    y = (n-1)*leading + ease(t,0,easeDur,0,leading);
    }
    value - [0,y]
  • Stuart Reid

    March 17, 2024 at 3:47 pm

    Magnificent!

  • Brie Clayton

    March 17, 2024 at 5:29 pm

    Thank you for solving this, Dan!

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