If the shape is meant to follow the text like a little dog, it's probably easier to parent it to the text.
Then use your size expression, and in the position, use an expression that sets the center of the rectangle at the center of the text, like this:
rect = thisComp.layer("Hello people").sourceRectAtTime(time-s.inPoint,true);
[rect.left + 0.5*rect.width, rect.top+0.5*rect.height];
It should work (provided that the anchor point of the shape is at default ([0,0]) and if there groups between the shape layer and the rectangle their position/anchorPoint should also be at their default)
and is completely independant of justification, number of lines, etc
Yes! That worked PERFECTLY! Plus, adding a padding variable to the SIZE expression gives a uniform padding around the entire rectangle!
Thanks much UQg!
Cheers, you made my day!
I prefer to use the shape group transform for this. one expression, simple. no problem.
reset your rectangle path properties and use the shape group transform ONLY:
set your anchor point to where you wish. make sure its there, no snapping for shape group's anchor point yet unfortunately.
use scale + position to set your shape
set this expression for the scale:
t=thisComp.layer("text"); padding=50; x=t.sourceRectAtTime(time-inPoint,true).width+padding; [x,value]
I keep the Y value free so adjust through the scale property itself.
here's the project file:
1 person found this helpful
Alas that will not work with corner roundedness.
Has this been answered anywhere else?
I think I have fixed this before, but project files not to hand.
I also think it didn't translate to Premiere via Animation Template (despite using sliders to be able to build it)