Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions SourceRectAtTime for multiple lines hack?

  • SourceRectAtTime for multiple lines hack?

  • Roei Tzoref

    February 2, 2018 at 7:23 pm

    is `SourceRectAtTime()` possible for multiple lines of text as a one block of text i.e for one text layer with multiple lines and line breaks . I am looking for creating a typewriter text for a paragraph of text and that for each line of text the rectangle fits.

    Thanks

    Roei Tzoref
    2D/VFX Generalist & Instructor
    ♫ AeBlues Tutorials ♫
    http://www.tzoref.com

  • Kevin Camp

    February 3, 2018 at 1:52 am

    can you do the typewriter effect in the source text? if so, sourceRectAtTime() should work for what I think you are trying to do.

    You may want to have a fixed width for the rectangle, but as the text types onto a new line the box should expand vertically to accommodate the new line(s).

    a simple type-on expression in source text would be something like this:

    rate = 10 ; // characters per second
    substr( 0, rate * ( time – inPoint ) )

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

  • Roei Tzoref

    February 3, 2018 at 7:54 am

    Hi Kevin, I need this for a transcript animation that follows a sound guide so I do need an end keyframe that I could animate.

    Roei Tzoref
    2D/VFX Generalist & Instructor
    ♫ AeBlues Tutorials ♫
    http://www.tzoref.com

  • Kevin Camp

    February 10, 2018 at 12:51 am

    sorry Roei, just saw this…

    if you are still working on this, add a slider to the text layer and set keyframes to animate from 0 to 1, then try this expression:

    completion = effect(“Slider Control”)(“Slider”) ;
    n = linear( completion, 0, value.length ) ;
    substr( 0, n )

    the text will type-on based on the keyframes set on the slider.

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

  • Roei Tzoref

    February 10, 2018 at 5:59 pm

    thanks Kevin. I tried but I don’t see any different result than simply not using the expression and regular animator with scale property. here’s my problem:

    when I want it to look like this:

    here’s the project file if you can test it:
    https://drive.google.com/open?id=1JWBrWp8s_stqHTVK5zMMTJb6bEdc1EBP

    you can use myriad hebrew.

    Roei Tzoref
    2D/VFX Generalist & Instructor
    ♫ AeBlues Tutorials ♫
    http://www.tzoref.com

  • Kevin Camp

    February 15, 2018 at 3:31 am

    now i see what you are trying to do…

    the only way I think you can do this is to use separate text layers for each line…

    it would be nice to have one master text layer that you type into, and then expression on several other text layers that parse the ‘master’ text into separate lines bassoon newlines (\n or \r\n), but i’ve never been able to get after effects to detect a newline, just a hard return (\r).

    example:

    text.sourceText.split(‘\r’)[1]; // will return the second line after a hard return (carriage return)

    but

    text.sourceText.split(‘\n’)[1]; // will will not return the second line after a newline wrap in area text

    maybe some one has found a workaround to detect newlines and will chime in.

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

  • Roei Tzoref

    February 15, 2018 at 5:00 pm

    Thanks for all your feedback Kevin.

    Roei Tzoref
    2D/VFX Generalist & Instructor
    ♫ AeBlues Tutorials ♫
    http://www.tzoref.com

  • Costel Letsoc

    February 21, 2018 at 5:42 pm

    I’m dealing with a similar question which is what do you have to do in case you have a strap with two lines of text

    Line1; Full Name (format text = Bold 50pt)
    Line 2; Description (format text = Regular 35pt)

    and the box needs to adjust size based on the line that is the longest one …

    Size of bg box to be scaled on the Text Source “Full Name “+ Text Source “Description”

  • Roei Tzoref

    May 26, 2019 at 2:09 pm

    posting this template. please try it and see if that works for you and give me a feedback ☺
    https://drive.google.com/file/d/1wROzAUeBnMFo9SiDrns041grLKD40YKf/view?usp=drivesdk

    Roei Tzoref
    2D/VFX Generalist & Instructor
    ♫ AeBlues Tutorials ♫
    http://www.tzoref.com

  • Tomas Bumbulevičius

    May 26, 2019 at 2:30 pm

    Roei, thats an interesting approach. However, when applying different text lengths, each line sizes varies.

    For example, add a lot of ‘i’s in the same line and you will see what I mean.

    I built a template called Boxer, which allows achieving the following with up to 10 lines.

    This is exaggerated outcome, by animating the sliders, but all lines as well as all the distances are calculated automatically.

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.
    Boxer – Dynamic Text Boxes Template with a Live Preview

Viewing 1 - 10 of 15 posts

Log in to reply.

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