Copy link to clipboard
Copied
I'm using a expression that locks scale of layer even when scaling the parent.
I need to lock only scale the Y axis.
Can someone help?
L = thisLayer;
s = transform.scale.value;
while (L.hasParent){
L = L.parent;
for (i = 0; i < s.length; i++) s[1,i] *= 50/L.transform.scale.value[1,i]
}
s
Scale is an array [x, y, z] for 3D layers. x [0], y is [1], and z is [2]. If the layers are 2D then all you need to do is use the s[0] value for x and the existing value for y.
Here's how to do that:
L = thisLayer;
s = transform.scale.value;
while (L.hasParent){
L = L.parent;
for (i = 0; i < s.length; i++) s[1,i] *= 50/L.transform.scale.value[1,i]
}
[s[0], value[1]]
Now any value you enter or even animate for y will not be affected by the scale of the parent.
Copy link to clipboard
Copied
Scale is an array [x, y, z] for 3D layers. x [0], y is [1], and z is [2]. If the layers are 2D then all you need to do is use the s[0] value for x and the existing value for y.
Here's how to do that:
L = thisLayer;
s = transform.scale.value;
while (L.hasParent){
L = L.parent;
for (i = 0; i < s.length; i++) s[1,i] *= 50/L.transform.scale.value[1,i]
}
[s[0], value[1]]
Now any value you enter or even animate for y will not be affected by the scale of the parent.
Copy link to clipboard
Copied
Thank you for helping me learn.
Copy link to clipboard
Copied
Hey Rick
How would one adapt / flip this this expression to only allow scaling in the x axis instead of the y axis?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now