OMG, why does this not exist? Honestly, if a box is created it shouldn't even Just be exposed to expressions, it should be exposed to the user. Right now, the way it works is Kind of dumb. You can move the text box completely independently of the layer's position and anchor point. Well, that's all fine and all IF the user has access to the box's transforms as well. Shouldn't it work just like a shape? The shape Layer itself has transforms for the layer, but a rectangle shape within that layer Also has it's own properties like size, position, and an entirely new set of transforms just for that object.
This is how a paragraph text box should also work. It would be even better if you just let us wrap text inside a shape layer so it isn't even limited to just a rectangle. I mean, powerpoint has that. If powerpoint can do it, AE should be able to do it right? That's always a disappointing realization.
We need access to the bounding box of paragraph text by expression. If this were possible, we could flexibly change the width and height of paragraph texts directly. Furthermore, a precise setting of the size of the text box would be possible (currently, the box can only be set manually). Currently we can only change the width of a paragraph text by scaling. But this also changes the size of the font. As a workaround we adjust the font size again: e.g. var txtFontSize = 100 * (100/transform.scale[0]); All these workarounds cause complicated solutions.
/t5/after-effects-ideas/expose-paragraph-text-box-width-height-for-expressions/idc-p/15655272#M5324Jan 07, 2026
Jan 07, 2026
Copy link to clipboard
Copied
@ShiveringCactus Would it be possible to provide a new link to the text file for your workaround, please? Bitly reports that the link is broken (I don't know if it actually is, or they just can't access Dropbox for whatever reason).
I only ask because I assume the code in the video doesn't incorporate the change you mention in the UPDATE of the video comments, with regard to soft returns. I did search for the Reddit post you mentioned in that update, but couldn't find it.
Alternatively, if you can just post what the code change for soft returns involves, I can add it to my transcript of the code from the video.
/t5/after-effects-ideas/expose-paragraph-text-box-width-height-for-expressions/idc-p/15656742#M533128m ago
28m ago
Copy link to clipboard
Copied
Actually, @ShiveringCactus , I did have another question about your expression.
After transcribing it from the video, I tried it out and discovered that it didn't work for me. After some painstaking debugging (in part using your tip on How to Get a Variable Value, so thank you for that, too!), I found the following issue, which is making me wonder how (or rather why) the code is working for you.
The issue is around these lines, particularly the second:
And this is the part where I can't figure out why it works that way for you. 'textArray' is made by splitting on spaces, but there's no space between "Solvin'.||" and "This". When I tried it with my own text, I got the equivalent of:
And then the code that handles looking for the separator character doesn't end up working because it adds a newline character to the end of any word with a separator in it, so (e.g.) textArray[4] would end up being
"Solvin'.||This\n"
which is not ideal, since the newline is now in a different place from where it originally was.
In the video, that doesn't appear to happen in the demo, but I can't figure out why not. Any insights into this?
/t5/after-effects-ideas/expose-paragraph-text-box-width-height-for-expressions/idc-p/15656748#M533225m ago
25m ago
Copy link to clipboard
Copied
LATEST
UPDATE: I just realized why I had that problem. I caught what looked like a typo in your code, but it turns out to be the fix!
The line
word + '\n';
was originally written as
word += '\n';
and that's what I had in my code. (I didn't notice until now that at 4:54 in the video, the line suddenly changes and the '=' disappears!)
As it is now (without the '='), that line doesn't actually do anything, because it doesn't assign the result of word + "\n" back to word. The only thing that happens in that if statement is that the count variable is updated.
That slightly affects the accuracy of the width calculation: the first line after each line break will be calculated to be longer than it actually is. But that will just make those lines a bit shorter which doesn't affect the overall functionality of the expression.
In any case, it's still a great solution to the original problem posted in this thread, so thanks for coming up with it and thanks again for the update.