![]() The OP doesn’t need a group or 2 objects so the code you have posted (and photics) would be bloated. except he has 2 objects he wants to rotate that are inside a group. ![]() ![]() Change this to “document” or “window” and you should be good.Įdit: the code I used is the same as Photics. This would make the dimensions of the scene the restrictions of where the mousemove would be detected so if you go off the scene then the detection stops. With tElementProperty(box, 'rotateZ', angle)Īs mentioned in the code I used “element” (which is the scene) as the element to listen for the mouse move event. Var angle = Math.atan2(e.pageX- boxCenter,- (e.pageY- boxCenter) )*(180/Math.PI) īox.style.webkitTransform = "rotate(" + angle + "deg)" īox.style.mozTransform = "rotate(" + angle + "deg)" īox.ansform = "rotate(" + angle + "deg)" Īlso, “Position with CSS left/top” needs to be checked in the Document inspector.įorgot you could also set an element’s rotateZ with Hype’s API too so you can replace = "rotate(" + angle + "deg)" here element is the scene (as function is run on scene load) ![]() I chose this way :)īox.left = hypeDocument.getElementProperty(box, 'left') īox.width = hypeDocument.getElementProperty(box, 'width') īox.top = hypeDocument.getElementProperty(box, 'top') īox.height = hypeDocument.getElementProperty(box, 'height') Vanilla Javascript (using Hype’s API also) // could use hypeDocument.getElementById('blah').
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |