Parenting 'Counter Rotation' in Shape Layers

Moderators: Disciple, zlovatt

Post Reply
User avatar
Tooklast
Posts: 1
Joined: August 28th, 2023, 4:00 am

Hello Peeps!

Problem:
A single shape Object (a ball) with two groups inside it:
1. Ball's Highlight, The Ball

If these shapes where split into separate layers, I can use this script, to stop the child layer (highlight) rotating with it's paren, so that the highlight stays in place, rather that rotating.

I use:

L = thisLayer;
r = 0;
while(L.hasParent){
r += L.parent.rotation;
L = L.parent;
}
-r

BUT this relies on having Separate Parented Layers (for Highlights), which soon gets messy.

Experimenting, If I modified the script to look at the Shape's 'Parent' (the Ball in this case), the script works, I can rotate the shape> ball>transform>rotation and the highlight layers counter rotates: with this is applied to the ball highlights shape:

L = content("Balls").transform.rotation;
r = 0;
while(L.hasParent){
r += L.parent.rotation;
L = L.parent;
}
-r

Ideally, I'd like to be able to create a single shape object, and then use the layer's master rotation (transform.rotation) to animate rotation of the shape, but have selected layers within the shape 'counter' the rotation, as per the layer script.

I would love some big brain help to achieve this!

test.png
test.png (80.59 KiB) Viewed 48456 times
Post Reply