[Flash 11+]

Mars 2015

Testing Starling Sprite3D class ( Starling 1.6+ )

My card object extends starling.display.Sprite3D

		private function _onStarlingEnterFrame(e:EnterFrameEvent):void 
		{
			var dx:Number = _cursor.x - _cardCursor.x;
			var dy:Number = _cursor.y - _cardCursor.y;
			
			_cardCursor.x += (dx * .1 );
			_cardCursor.y += (dy * .1 );
			
			_cardCursor.rotationX = dx / 360; // pitch
			_cardCursor.rotationY = dy / 720; // roll
		}

update april 2015
modification to be usable on a surface pro 3

// removed
//stage.align = StageAlign.TOP_LEFT;

and

//added TouchPhase.HOVER to handle mouse over in desktop context
if ( touch.phase == TouchPhase.HOVER || touch.phase == TouchPhase.MOVED )
{
	// "pointer" is moving
}

Vote in HexoSearch