Return to Snippet

Revision: 21708
at December 18, 2009 16:00 by adamcoulombe


Initial Code
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);
				}
	});
}

Initial URL
http://www.adamcoulombe.info/lab/as3/360-spin-hover.html

Initial Description
demo: http://www.adamcoulombe.info/lab/as3/360-spin-hover.html
FLA: http://www.adamcoulombe.info/lab/as3/360-spin-hover.fla

requires tweenlite

Initial Title
Simple 3D 360 Spinning Hover effect with AS3 and Tweenlite

Initial Tags
flash, simple

Initial Language
ActionScript 3