See if this works – take note that it doesn’t account for keyframing the checkbox which will result in position jumping –
for xPosition –
if (effect(“Checkbox Control”)(“Checkbox”) == 1 || thisLayer.parent == null) {
// When checked or no parent, use normal/parented position value
value;
} else {
// When unchecked, counteract parent’s position
parentLayer = thisLayer.parent;
// Get parent’s world position at current time
parentWorldPos = parentLayer.toWorld([0,0]);
// Get parent’s world position at time 0 (initial position)
parentWorldPosT0 = parentLayer.toWorld([0,0], 0);
// Calculate parent’s position change
parentDeltaX = parentWorldPos[0] – parentWorldPosT0[0];
// Subtract parent’s movement from our current position
value – parentDeltaX;
}
for yPosition –
if (effect(“Checkbox Control”)(“Checkbox”) == 1 || thisLayer.parent == null) {
// When checked or no parent, use normal/parented position value
value;
} else {
// When unchecked, counteract parent’s position
parentLayer = thisLayer.parent;
parentWorldPos = parentLayer.toWorld([0,0]);
parentWorldPosT0 = parentLayer.toWorld([0,0], 0);
parentDeltaY = parentWorldPos[1] – parentWorldPosT0[1];
value – parentDeltaY;
}