Measure text layer with sourceRectAtTime()

Moderators: Disciple, zlovatt

Post Reply
Posts: 6
Joined: February 28th, 2017, 4:04 am

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

User avatar
Posts: 3
Joined: November 4th, 2016, 11:01 am

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?
Post Reply