Return to Snippet

Revision: 33384
at October 8, 2010 08:01 by adamcoulombe


Initial Code
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
import com.greensock.TweenLite; // get tweenlite at http://www.greensock.com/tweenlite/

var rotationValue;
orbit.rotationX = 90; // First rotate the whole Movieclip back 90 degrees in 3d space
for(var i=0; i<orbit.numChildren; i++){ // Now rotate all the inside MovieClips back up to the correct orientation again
	var planet = orbit.getChildAt(i);
	planet.rotationX = -90;
}

addEventListener(Event.ENTER_FRAME,doOrbit)

function doOrbit(e){
	rotationValue = (mouseX + stage.stageWidth / 2) * 1.5 ;
	TweenLite.to(orbit,0.5,{rotationY:rotationValue}); // orbit spins around the Y axis
	for(var i=0; i<orbit.numChildren; i++){
		var planet = orbit.getChildAt(i);
		TweenLite.to(planet,0.5,{rotationZ:rotationValue});  // each polkadot spins around Z axis to correct the orientation
	}
	SimpleZSorter.sortClips(orbit);
}

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

Initial Description


Initial Title
3d Polkadot Carousel in AS3

Initial Tags
actionscript, flash

Initial Language
ActionScript 3