Copy link to clipboard
Copied
Hi, I have a problem with sourceRectAtTime() I'm trying to parent shape layer to the top edge of the text layer with some offset and its working when Im adding another line of text or when i change leading, but when i change font size the position of the shape layer doesnt change. Someone know how to fix it?
anchor point text layer expression:
left = sourceRectAtTime().left;
top = sourceRectAtTime().top;
width = sourceRectAtTime().width;
height = sourceRectAtTime().height;
x = 0;
y = top + height;
[x,y]
anchor point shape layer expression:
left = thisComp.layer("text").sourceRectAtTime().left;
top = thisComp.layer("text").sourceRectAtTime().top;
width = thisComp.layer("text").sourceRectAtTime().width;
height = thisComp.layer("text").sourceRectAtTime().height;
x = 0;
y = top + height;
[x,y]
By the way, you can also do these kinds of parenting very easily with my (paid) extension Pins & Boxes.
Just create a pin at the top center of the text layer and then parent your shape layer to it.
Copy link to clipboard
Copied
All your references use reserved keywords, which throws off the expression engine. You cannot arbitrarily use words like "height", "width" and so on because by default they refer to specific layer properties. Rename your variables to be unique, e.g. by adding a suffix and using Dvorakian notation: mHeight, mTop, mWidth, mLeft etc..
Mylenium
Copy link to clipboard
Copied
ok I will try
Copy link to clipboard
Copied
By the way, you can also do these kinds of parenting very easily with my (paid) extension Pins & Boxes.
Just create a pin at the top center of the text layer and then parent your shape layer to it.