Hi Dan, thanks very much for responding. I really appreciate it.
I have a master null and 4 “satellite” nulls parented to the master, initially set to 0, 90, 180 and 270 degrees respectively. Each of these 4 nulls have a few layers parented to them. These layers’ opacity is tied to its parent null. All 5 nulls are at the same position.
I’ve rotated the master null with keyframes, which rotates the satellite nulls and their children (like a baby’s mobile). The whole apparatus is like a cube.
The relationship I’m trying to make is that there should be a range where each face of the cube is 100% opacity when facing the camera, fading in as it approaches an angle (var a), and fades out as it moves away from that angle. My code works, but only for the first revolution, then it breaks. I have a text layer outputting my variable values. I’m just not sure how to tweak the code to make it work after the first 360 degrees.
My code on the opacity property on each of the satellite nulls, with added comments:
// on each satellite null's opacity. Children layers' opacity is pickwhipped to this value.
// this null's parent is "master null"
// a is either 0, 90, 180 or 270
var a = 180;
var r = (thisComp.layer("master null").transform.yRotation)%360;
var d = Math.abs(a-r);
ease(d, 10,36, 100,0);