/ Published in: ActionScript 3
demo: http://www.adamcoulombe.info/lab/as3/360-spin-hover.html
FLA: http://www.adamcoulombe.info/lab/as3/360-spin-hover.fla
requires tweenlite
FLA: http://www.adamcoulombe.info/lab/as3/360-spin-hover.fla
requires tweenlite
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import com.greensock.*; import com.greensock.easing.*; //addEventListener(Event.ENTER_FRAME, rotateSquare); square.addEventListener(MouseEvent.MOUSE_OVER, over); /*function rotateSquare(e:Event):void { square.rotation+=1; }*/ function over(e:MouseEvent):void { var sourceObject = e.target; square.removeEventListener(MouseEvent.MOUSE_OVER, over); TweenLite.to(sourceObject, 0.5, { rotationY:720,rotationZ:10,rotationX:10, y:sourceObject.y-25, ease:Strong.easeOut, onComplete:function(){ square.addEventListener(MouseEvent.MOUSE_OUT, out); } }); } function out(e:MouseEvent):void { var sourceObject = e.target; square.removeEventListener(MouseEvent.MOUSE_OUT, out); TweenLite.to(sourceObject, 0.5, { rotationY:0,rotationZ:0,rotationX:0, y:sourceObject.y+25, ease:Strong.easeOut, onComplete:function(){ square.addEventListener(MouseEvent.MOUSE_OVER, over); } }); }
URL: http://www.adamcoulombe.info/lab/as3/360-spin-hover.html