Sure, you can use the Get and Set Hype Api functions to Get, modify, and then Set a new rotation angle:
var currentZ = hypeDocument.getElementProperty(rect3, 'rotateZ');
console.log(currentZ);
var newZ = .5 + currentZ
hypeDocument.setElementProperty(rect3, 'rotateZ', newZ, .5, 'easeinout')
Clicking the gray rectangle repeatedly in this test doc will slowly rotate it clockwise by .5 degrees each time (over the span of half a second).
hypeDocument.setElementProperty(rect3, 'rotateZ', newZ, .5, 'easeinout')
To break down the line that actually does the animation: Rect3
is the Unique Element ID, rotateZ
is the property, newZ
is the actual number rotation angle which will be animated to, .5
is the animation duration, and easeinout
is the easing property.
test.zip (19.7 KB)