/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import com.greensock.TweenLite; // get tweenlite at http://www.greensock.com/tweenlite/ var rotationValue; addEventListener(Event.ENTER_FRAME,doOrbit) function doOrbit(e){ rotationValue = (mouseX + stage.stageWidth / 2) * 0.5; TweenLite.to(orbit,0.5,{rotationZ:rotationValue}); //had to use Z axis rotation (basically the same thing) for(var i=0; i<orbit.numChildren; i++){ var planet = orbit.getChildAt(i); TweenLite.to(planet,0.5,{rotationZ:rotationValue*-1}); } }
URL: http://www.adamcoulombe.info/lab/as3/polkadot-orbit.html