-
Having elements track corners of text layer
I’m trying to get 2 rectangles to automatically follow the upper left and lower right corners of a text layer, using a “sourceRectAtTime()” expression.
I managed to get each rectangle to go to their respective corners, but the moment the text layer starts moving, or text gets added/subtracted, the corners don’t follow properly.
The expression for the top left rectangle is:
src=thisComp.layer(“Quote”);
w=src.sourceRectAtTime().width;
h=src.sourceRectAtTime().height;
l=src.sourceRectAtTime().left;
t=src.sourceRectAtTime().top;
[-(w+l),h+t]
For the bottom right one:
src=thisComp.layer(“Quote”);
w=src.sourceRectAtTime().width;
h=src.sourceRectAtTime().height*2;
l=src.sourceRectAtTime().left;
t=src.sourceRectAtTime().top;
[w+l,h+t]
I have uploaded the AEP file here, in case you want to have a look at it directly: https://www.dropbox.com/s/4dbsmr2ics64d08/cornertrack.aep?dl=0