ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

sourceRectAtTime for paragraph text. Difference between inner and outer bounding box?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jeremy Dance
sourceRectAtTime for paragraph text. Difference between inner and outer bounding box?
on Aug 15, 2018 at 3:58:12 pm

Here is a video that shows in 6 seconds what I am trying to do

https://www.reddit.com/r/AfterEffects/comments/97bwuc/ive_used_sourcerectat...

I've use sourceRectAtTime a lot to resize boxes behind text. It works great. However I'm running into a problem when I use the horizontal text tool, or "paragraph text" as I call it. I'd like to use the constraints of paragraph text and sourceRectAtTime to create a shape layer that scales with the text as it is typed on using the typewriter effect. It seems that there are two bounding boxes for paragraph text, and I don't know how to access the "inner" bounding box. Let me explain.

When you use the horizontal (or vertical for that matter) text tool in After Effects, you get a paragraph bounding box that will constrain text to that box. This is what I'm referring to as the "outer" bounding box. If you use sourceRectAtTime to resize a shape layer then it will properly resize to the "outer" bounding box you have set with the horizontal text tool. However, when you click away, After Effects shows another bounding box with only encircles the text on screen. Is there anyway to access the dimensions of this "inner" bounding box? After Effects is already calculating it for user interface reasons. How do I access it?

//code to access the paragraph bounding box
watchLayer = thisComp.layer("myParagraphText");
myHeight = watchLayer.sourceRectAtTime(time-watchLayer.inPoint,true).height;
heightBuffer = thisLayer.effect("heightBuffer")("Slider");
myHeight + heightBuffer;


Return to posts index

Dan Ebberts
Re: sourceRectAtTime for paragraph text. Difference between inner and outer bounding box?
on Aug 15, 2018 at 4:13:04 pm

Try changing:

sourceRectAtTime(time-watchLayer.inPoint,true)

to:

sourceRectAtTime(time-watchLayer.inPoint,false)


Dan



Return to posts index

Jeremy Dance
Re: sourceRectAtTime for paragraph text. Difference between inner and outer bounding box?
on Aug 15, 2018 at 4:25:38 pm

Just figured it out. For those wondering, it is possible to access the "inner" bounding box. It is called the extents. If you put false (rather than true as I had done) it will only consider the extent of the text, rather than the extent of the paragraph bounding box.

watchLayer = thisComp.layer("myParagraphText");
myHeight = watchLayer.sourceRectAtTime(time-watchLayer.inPoint,false).height;
heightBuffer = thisLayer.effect("heightBuffer")("Slider");
myHeight + heightBuffer;


Return to posts index

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