Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Panorama panel.position workaround - Requires Vectors.js! (https://github.com/Perryvw/Phase/blob/master/src/Vector.js)
- //Credits to Perry
- function SetPositionRotation( element, position, rotation ) {
- var oldPosition = element.data().oldPosition || new Vector();
- var oldRotation = element.data().oldRotation || 0;
- //Revert previous transformation
- element.style.transform = "translate3d(" +
- -oldPosition.x + "px, " + -oldPosition.y + "px, 0px) rotateZ("+(-oldRotation)+"deg)";
- //Apply new transformation
- element.style.transform = "rotateZ("+rotation+"deg) translate3d(" +
- position.x + "px, " + position.y + "px, 0px)";
- element.data().oldPosition = position;
- element.data().oldRotation = rotation;
- }
- //Example Usage:
- SetPositionRotation( $('#someID'), new Vector(100, 0, 0), 43 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement