Page 1 of 1

Measure text layer with sourceRectAtTime()

Posted: February 28th, 2017, 4:15 am
by SundancePioneer
Hey folks,

i'm currently trying to wrap my head around using the sourceRectAtTime() expression to measure any given text layer (selected using layer control) to create a text box. 

The basic functionality works fine, i can create a shape with the exact dimensions. But the positioning of the shape layer doesn't work as expected. I want the shape layer to be dynamic - in the way that i can select any text layer in the comp and make the shape layer have the correct dimensions and positioning to be behind the text layer. 

I used the .top and .left output values the position the shape layer, but the values place the layer somewhere else. I managed to find the correct position subtracting the text layers' position from the top/left values - but whenever i change the source text, it's off again. 

Is there any way to force the width, height and position of the shape layer to always match the text layer? 

Thanks in advance - any help is greatly appreciated


Re: Measure text layer with sourceRectAtTime()

Posted: March 5th, 2017, 1:39 pm
by conigs
Do you still need help with this? .top and .left should give you comp-space coordinates. Is there parenting involved or anything else adjusting the text sizing/position? Can you share the expression you're using?