I’ve been messing around with this but I still haven’t got to the results that I wish it to be.
I’ve got a text layer (in a bounding box). But the content (the source text) may change later. It’s been rigged with an thisComp.layer(“TEXT MASTER”).text.sourceText, so I can easily change this later.
Behind the text-layer there is a shape (rectangle) and I want it’s width to get larger + some extra space around it, because that looks nice. Let me show you:
So to sum it up: I want the width size of the rectangle behind the text to automaticly scale itself depending on the width of the text layer.
And after that I still want to animate it (with the anchorpoint in the middle, or at the far most right) to have it scale up from 0 to 100%).
Does anyone have a clue how I can get this done? I’m quite new at expressions, I roughly know the basics, this is why I’m seeking for help.
Well, it might be a beginners mistake, but I can’t seem to figure this out…
I’ve done exactly as you said but I think I still did this thing wrong.
It gives me errors when adding the expressions to the scale/position of the rectangle.
One of these errors are displayed below. I think I named my layers right. I did name my text layer for this example ‘my_text’.
Thank you for replying so fast!
Yeah, that’s it! I’ve been working on an older version (without knowing). I just updated to 13.2 instead of 13.0.2 and now it does work.
Only too bad still something goes wrong. The rectangle (which has an anchor point in the mid-centre of it) now positions itself with the anchor in the far upper right corner of the composition, and is far to wide. But the size DOES change the way I want it too, so I’m on the way to achieving what I’m looking for. Maybe I’m still doing something wrong. I’ve been trying other values aswel in the expression, but I still don’t get what I’m trying for.
Dan, thank you very much for helping me out with this.
That code really looks like a massive math project. Phew! How do you do it?! Haha!
I’ve been struggling with this for a few days now. I’m trying to make my projects somewhat easier to edit for later, like working with a Mastercomp where the texts can be changed later on and some colors that are used in the animation, you never know. This way I can make my animations more variable.
This is awesome! Thanks y’all! At first, when using Dan’s latest script there, I was having an issue with the box not aligning properly to the center of the text, and then I set my Rectangle anchor point to 0,0 and all was perfect with the world.
Of course, my text and box are centered absolute in the comp, so that may not be helpful to other purposes.