Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions expression for a text reveal gag

  • expression for a text reveal gag

    Posted by Vinny Visconti on March 18, 2016 at 9:41 pm

    i am building a movie that has like a thousand lines of “code” text and i want to have it type on and move up, revealing the next line of code at the bottom. like if you were running diagnostics on something.

    if moving up and typing on is difficult to code in expression, i’m at least looking for help getting the text to move up one line of text at a time. most things i’ve read tell me how to move up the whole image or whole block of text, but i’m looking to move up text line by line.

    here’s more about what i’m trying to accomplish –
    text moves up one line and the top line of text goes away and the bottom line of text is revealed and it holds for like 30 frames and then the next line at the top goes away and the next line at the bottom is revealed. it’s not a crawl or scroll, it’s by line.

    i do this often with keyframes and it takes forever and when something changes it takes me forever to rework everything, so i was looking for an expression to make this a fast workflow. i can use an expression to change the position of the text block, but then it doesn’t look like the new line of text shows up, it just looks like everything scrolling up like credits.

    when i keyframe i start at a point, move like 30 frames forward and end at that point and then move 1 frame forward and then “jump” to the position of the next line of text at the bottom, which makes it look like it was revealed and not rolled up like a credit sequence.

    Rick Lavon replied 10 years, 1 month ago 4 Members · 4 Replies
  • 4 Replies
  • Kalleheikki Kannisto

    March 21, 2016 at 8:11 am

    Syncronizing the typing through expression can be difficult as there are different number of letters pers line.

    For the text movement up I would use a Math.floor(time*multiplier) expression multiplied by line spacing. This would step the text up exactly one row at a time. So if your line spacing is 72, it would be:

    lps = 4; // lines per second
    spacing = 72;
    ypos = transform.position[1]-Math.floor(time*lps)*spacing;
    [transform.position[0], ypos]

  • Kevin Camp

    March 21, 2016 at 7:34 pm

    if syncing the characters per line and movement is an issue, I think you could do it with an expression to drive the characters typing on and an expression using sourceRectangleAtTime() function on the text layer…. essentially, as a new line types on, the new height of the text layer will shift it upwards..

    to type the characters on, add this expression to the source text (set the rate value as needed):
    rate = 60; // characters per second
    txt = text.sourceText;
    txt.substr(0,timeToFrames(time*rate*thisComp.frameDuration));

    to move the text up foe each new line add this to the position property:
    rect = sourceRectAtTime(time,false);
    h = Math.ceil(rect.height/10)*10;
    value - [0,h]

    then just drag the position of the text layer to where you want it to start, and the text should march up the screen as it types on.

    — edit —

    i should have added that you will need CC 2014 or higher to use the sourceRectAtTime() function.

    — edit (again) —

    i had been working with all caps, but if you are working with lowercase or have punctuation or other characters that extend bellow the baseline of the font, then you may need to futz around with the multipliers on this line to account for them:
    h = Math.ceil(rect.height/10)*10;
    I played around with this value and it works pretty well, but it might need to be adjusted for your font & font size:
    h = Math.ceil(rect.height/30)*30;

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

  • Vinny Visconti

    March 22, 2016 at 12:33 am

    i plan on testing these out in the next day or 2. but i am using cs6, so if it requires cc14, i won’t have any luck with yours, kevin. thanks to you both for taking the time.

  • Rick Lavon

    April 3, 2016 at 3:01 pm

    I just tried these expressions and they work wonderfully.

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