Orbiting Polkadots (interactive) in flash AS3


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import com.greensock.TweenLite; // get tweenlite at http://www.greensock.com/tweenlite/
  2.  
  3. var rotationValue;
  4.  
  5. addEventListener(Event.ENTER_FRAME,doOrbit)
  6.  
  7. function doOrbit(e){
  8. rotationValue = (mouseX + stage.stageWidth / 2) * 0.5;
  9. TweenLite.to(orbit,0.5,{rotationZ:rotationValue}); //had to use Z axis rotation (basically the same thing)
  10. for(var i=0; i<orbit.numChildren; i++){
  11. var planet = orbit.getChildAt(i);
  12. TweenLite.to(planet,0.5,{rotationZ:rotationValue*-1});
  13. }
  14. }

URL: http://www.adamcoulombe.info/lab/as3/polkadot-orbit.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.