-
sourceRectAtTime is misbehaving :(
So i have some fantastic expressions saved from a year or two ago that i periodically use. They are to make a shape layer (rectangle) fit exactly to a text layer and update with changing text. Just cracked them out for a job and they’re not working properly. The “size” seems to be doing it’s job but the “position” isn’t quite working, it IS changing the position but it’s overshooting so the text box requires manually repositioning each time. One interesting thing I noticed is that the terms “left” and “top” don’t seem to be the same colours as “width” and “height” so perhaps the expression vocab has changed since I used these. Quick note before you raed the expressions, these are to be pasted in the properties within the rectangle inside the shape layer, NOT in the main transform properties for the layer as a whole. Here are the expressions:
//Paste in Shape Layer Size//
s=thisComp.layer(“TEXT 1”);
w=s.sourceRectAtTime().width;
h=s.sourceRectAtTime().height;
[w,h]
//Paste in Shape Layer Position//
s=thisComp.layer(“TEXT 1”);
w=s.sourceRectAtTime().width;
h=s.sourceRectAtTime().height;
l=s.sourceRectAtTime().left;
t=s.sourceRectAtTime().top;
[w+l,h+t]
Any help greatly appreciated <3