Offsetting parented layers X and Y values

Creating a Position Offset with Expressions in After Effects

In Adobe After Effects, expressions can be used to create complex animations with ease. One such use case is creating a position offset for a layer that has been parented to another layer. This can be useful in a variety of scenarios, such as creating a trailing effect or animating multiple layers in relation to each other.

Understanding Parenting

Parenting is a way to establish a relationship between layers where one layer follows the transformation of another layer. The layer that is followed is referred to as the “parent” and the layer that follows is the “child”.

Creating a Position Offset

To create a position offset, we can use the value and transform.position properties in an expression. Here’s a basic example:

JavaScript
let offset = [50, 50]; // Offset in X and Y directions
thisComp.layer("Parent Layer").transform.position + offset;

In this example, the position of the child layer will be offset by 50 pixels in both the X and Y directions from the position of the “Parent Layer”.

Animating the Offset

To animate the offset, you can replace the static offset value with a time-dependent expression. For example:

JavaScript
let offset = [50 * time, 50 * time]; // Offset increases over time
thisComp.layer("Parent Layer").transform.position + offset;

Expression for position offset for layer that has been parented to the position of Parent layer.

JavaScript
myParent = thisComp.layer("master");
myProp = myParent.transform.position;
value + (myProp.value - myProp.valueAtTime(0))

Leave a Reply

Your email address will not be published. Required fields are marked *