The sourceRectAtTime expression is perfect for returning the width or height dimensions of shape and text layers. This is useful when trying to make box or line elements fit your text.

In this example, we create an expression on our shape layer’s path size value. Then, we make a variable and apply the sourceRectAtTime expression:


Then, we type in the x and y values (since this is a position) in brackets to have the shape layer follow the width of our text layer.

Check out this short video tutorial to see this quick and powerful expression in action: