-
sourceRectAtTime for paragraph text. Difference between inner and outer bounding box?
Here is a video that shows in 6 seconds what I am trying to do
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;