ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Maintaining Childs Scale when rotating, as Parent scales Non Uniformly

FAQ   •   VIEW ALL
 Maintaining Childs Scale when rotating, as Parent scales Non Uniformly on Dec 8, 2016 at 3:55:35 pm

How can I maintain the scale of a child, when animating it's rotation, who's Parent is also scaling non-uniformly?

I found this expression from Dan Ebberts, from a previous post that has helped tremendously.

L = thisLayer;
s = transform.scale.value;
while (L.hasParent){
L = L.parent;
for (i = 0; i < s.length; i++) s[i] *= 100/L.transform.scale.value[i]
}
s

The only problem is when I rotate the child, it becomes skewed as the Parent is also scaling non-uniformly.

Background:

I've recently purchased BAO Mask Avenger which allows you to attach objects to the vertices of both Masks and Shape Layers. I'm currently animating a character comprised of Shape Layers and would like to create a character rig using Shape Layers as the controllers.

Specifically I'm developing the Squash and Stretch portion of the rig right now. Thus far I have it working the way I want to, but I'd like to clean it up a bit. The rig consists of 1 Parent with 6 Children. Each Child Controller is a Shape Layer, with 1 Main Shape Group (Master), which contains 3 Nested Groups (In, Out, Point). These represent and are attached to the Vertex and Bezier Handles for each point on the Shape Layer.

By attaching each controller to the vertices and then parenting them to a master controller, I can simply scale the Master up and down or use the linear expression to create the Squash and Stretch. The first problem I ran into was maintaining the scale on the Child Controllers as the Master scaled non uniformly. I was able to resolve this by using the above expression.

At first I applied this expression to the Scale property of the Shape Layer itself, but soon discovered that I needed to apply it to the Scale property of the 3 Nested Groups. Not the Main group. Once this was done, everything was working beautifully until I rotated the layer itself. As the layer rotates, it becomes skewed if the parent is scaled non-uniformly.
This is meant to be a Squash and Stretch rig, so the parents scale will be something like 140, 64 when Squashed or 64, 140 when Stretched. All the Child Controllers move appropriately thus maintaining a smooth curve.

Anyways, help in this matter would be greatly appreciated.