ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

SourceRectAtTime for multiple lines hack?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Roei Tzoref
SourceRectAtTime for multiple lines hack?
on Feb 2, 2018 at 7:23:55 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


Return to posts index

Kevin Camp
Re: SourceRectAtTime for multiple lines hack?
on Feb 3, 2018 at 1:52:42 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


Return to posts index

Roei Tzoref
Re: SourceRectAtTime for multiple lines hack?
on Feb 3, 2018 at 7:54:44 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


Return to posts index


Kevin Camp
Re: SourceRectAtTime for multiple lines hack?
on Feb 10, 2018 at 12:51:30 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


Return to posts index

Roei Tzoref
Re: SourceRectAtTime for multiple lines hack?
on Feb 10, 2018 at 5:59:26 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


Return to posts index

Kevin Camp
Re: SourceRectAtTime for multiple lines hack?
on Feb 15, 2018 at 3:31:14 am
Last Edited By Kevin Camp on Feb 15, 2018 at 3:39:30 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


Return to posts index


Roei Tzoref
Re: SourceRectAtTime for multiple lines hack?
on Feb 15, 2018 at 5:00:15 pm

Thanks for all your feedback Kevin.

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


Return to posts index

Costel Letsoc
Re: SourceRectAtTime for multiple lines hack?
on Feb 21, 2018 at 5:42:38 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"


Return to posts index

Roei Tzoref
Re: SourceRectAtTime for multiple lines hack?
on May 26, 2019 at 2:09:46 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=...

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


Return to posts index


Tomas Bumbulevičius
Re: SourceRectAtTime for multiple lines hack?
on May 26, 2019 at 2:30:22 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


Return to posts index

Roei Tzoref
Re: SourceRectAtTime for multiple lines hack?
on May 26, 2019 at 2:47:48 pm

[Tomas Bumbulevičius] "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."


thank you Tomas, yes that's why I made controllers.

is there a way to test your preset before purchasing?

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


Return to posts index

Tomas Bumbulevičius
Re: SourceRectAtTime for multiple lines hack?
on May 27, 2019 at 5:18:05 pm

Hey Roei,

yesterday I responded to your message with suggestions on how to improve your design, but it was removed due to the fact that I provided more insights about my template, like it would be a spam.. Oh well, lesson learned ☺

Anyways, to break down your current solution, I think its an interesting approach, yet there are few important things to think about. It is essential that such 'boxed' design would adapt automatically without a need to tweak paddings, etc. As otherwise, it looses the main purpose of easy update with different phrases. With that said, look for way to improve it from this point of view.

As for my design, I spent quite a lot of time to narrow it down to the point of re-usable template. There is no demo project to test it out, but if you want to have a look at what is possible to do with it -



In case you have some questions about it, feel free to contact me directly. Cheers.

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


Return to posts index


Roei Tzoref
Re: SourceRectAtTime for multiple lines hack?
on May 28, 2019 at 2:00:14 am

Thank you. I have a question about the limit in your template. why is there a 10 line limit?

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


Return to posts index

Tomas Bumbulevičius
Re: SourceRectAtTime for multiple lines hack?
on May 28, 2019 at 6:22:00 am

The limit of 10 lines is simply my choice to make it more robust and not to clog execution with redundant amounts of data. I don't see a real reason where someone could use more than 10 lines of text, especially for dynamic social media posts. Its unlikely to use text appearances with loads of paragraph texts, which might go beyond.

Each line can contain as many characters as needed.

In the gif below, you can see that once the number of chars per line reaches certain threshold ratio, whole phrase scales down (its adjustable). Meaning, it also allows user to avoid having text reaching outside the boundaries of the comp size - which is super useful for adding phrases without worrying of extra size/lines tweaking. Also, growing of lines is possible from all 9 locations (top, center,bottom, left, center, right), combined cases.



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


Return to posts index

Roei Tzoref
Re: SourceRectAtTime for multiple lines hack?
on May 28, 2019 at 1:51:07 pm
Last Edited By Roei Tzoref on May 28, 2019 at 2:11:23 pm

Thank you Tomas. this preset looks very good and efficient. if I need that sort of thing I will use it. I already posted it where there was a discussion about it ☺

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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]