Symmetry Expressions for Anchor Points and Positions

From the “Posted on the Blog so I Can Remember it Next Time” department: A useful expression for making things symmetrical.

2016-09-06 18_02_07-Often you will be faced with the task of making a complicated composition symmetrical. For example this beetle I am rigging has six leg layers on each side. Rather than go nuts trying to align it all by eye I used an expression on the layers on one side to make them symmetrical with the layers on the other.


So I used this expression on the position property of the right hand side object:

pair = thisComp.layer(name.replace("L", "R"));
[parent.width - pair.transform.position[0], pair.transform.position[1]]

And on the anchor point property:

pair = thisComp.layer(name.replace("L", "R"));
[width-pair.transform.anchorPoint[0], pair.transform.anchorPoint[1]]

This mirrors any layers on the left hand side to their counterpoint on the right hand side. It finds the pair by replacing the firstĀ L it finds in the layers’ names with an R, so it’s important that they are named in pairs, like L_upper_leg and R_upper_leg or UpperLArm and UpperRArm. If you wanted to mirror the right side to the left, you’d swap the terms in the replace function around, i.e.: replace("R", "L")

This looks like a good candidate for scripting, so stay posted.

Leave a Reply

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