Posted By

adamcoulombe on 10/08/10


Tagged

actionscript flash interactive as3


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

thastyle
alptugan
tspitzr
Leang
peternoster


3d Polkadot Carousel in AS3


 / Published in: ActionScript 3
 

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

  1. import com.theflashblog.fp10.*; // get lee brimelow's simplezsorter classes here: http://code.google.com/p/leebrimelow/source/browse/trunk/as3/com/theflashblog/fp10/?r=13
  2. import com.greensock.TweenLite; // get tweenlite at http://www.greensock.com/tweenlite/
  3.  
  4. var rotationValue;
  5. orbit.rotationX = 90; // First rotate the whole Movieclip back 90 degrees in 3d space
  6. for(var i=0; i<orbit.numChildren; i++){ // Now rotate all the inside MovieClips back up to the correct orientation again
  7. var planet = orbit.getChildAt(i);
  8. planet.rotationX = -90;
  9. }
  10.  
  11. addEventListener(Event.ENTER_FRAME,doOrbit)
  12.  
  13. function doOrbit(e){
  14. rotationValue = (mouseX + stage.stageWidth / 2) * 1.5 ;
  15. TweenLite.to(orbit,0.5,{rotationY:rotationValue}); // orbit spins around the Y axis
  16. for(var i=0; i<orbit.numChildren; i++){
  17. var planet = orbit.getChildAt(i);
  18. TweenLite.to(planet,0.5,{rotationZ:rotationValue}); // each polkadot spins around Z axis to correct the orientation
  19. }
  20. SimpleZSorter.sortClips(orbit);
  21. }

Report this snippet  

You need to login to post a comment.