-
Clamping the result of a radiansToDegrees expression…
Hi there,
I have a null with a simple radiansToDegrees expression applied to its rotation property, calculating the angle based on the layer’s own position relative to a specified anchor point within the comp…
delta = [250,700] – transform.position;
-radiansToDegrees(Math.atan2(delta[0], delta[1]))I now want to link another layer’s rotation to that result, but clamp its range between, let’s say, 0 – 270 degrees. At the moment, the value is snapping back to zero when I reach beyond 180 degrees, since it’s being told that its value is -179, rather than +181 degrees.
r2dResult = thisComp.layer(“Null 1”).transform.rotation;
clamp(0,270, r2dResult)I’m sure there’s a simple way to correct this, but I haven’t yet been able to figure it out. Any ideas?
Thanks in advance,
DP