[Flash 11+]

Mars 2015

Testing Starling Sprite3D class ( Starling 1.6+ )

[swfobj src=”https://yopsolo.fr/ressources/HeartStoneStarlingTest” alt=”Animation Flash” width=”1024″ height=”720″ wmode=”direct” AllowScriptAccess=”sameDomain” allowfullscreen=”false” bgcolor=”#ffffff” required_player_version=”11″]

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
}