Relative timeline with rotation

I’m trying to use a relative timeline with a rotating shape so that I can rotate it one way and then, from the position where it is, rotate it back.

That’s fine as long as I don’t spin it too many times in one direction - what I’d like to be able to do is reset it’s relative position to 0 degrees once it gets to 360 - otherwise when you rotate back, it does a huge spin to get back to zero - I just want to spin in one way one or more times and then spin back from where it is.

The problem is making the number of degrees you spin the object relative.

Confusing ? yes but not when you try to do it - I just want to create a dial that I can turn one way and then the other.

Ideas anyone ?

I think what you’d want to do is first have an action that would run javascript and convert the degrees to the 0-360 range. It would probably look like:

var element = hypeDocument.getElementById("myID");
var degrees = hypeDocument.getElementProperty(element, "rotateZ");
var normalizedDegrees = Math.round(degrees) % 360;
hypeDocument.setElementProperty(element, "rotateZ", normalizedDegrees);

(needing to supply an ID in “myID” for the element)