In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

ケサランパサラン

Get Adobe Flash player
by Kay 25 Jun 2009
package {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.geom.Matrix3D;
	import flash.geom.Utils3D;
	import flash.geom.Vector3D;
	import net.hires.debug.Stats;
	[SWF(backgroundColor=0x000000,width=465,height=465,frameRate=60)]
	public class Take01 extends Sprite {
		private var container:Sprite;
		private var world:Matrix3D;
		private var apexes:Vector.<Number> = new Vector.<Number>();
		private var uvt   :Vector.<Number> = new Vector.<Number>();
		private var hairNum:uint = 100;
		public function Take01():void {
			for (var i:uint = 0; i < hairNum; i++) {
				var anchor:Vector3D = new Vector3D(
					Math.random()*300-150,
					Math.random()*300-150,
					Math.random()*300-150 );
				var control:Vector3D = new Vector3D(
					anchor.x/2 + Math.random()*60-30,
					anchor.y/2 + Math.random()*60-30,
					anchor.z/2 + Math.random()*60-30 );
				apexes.push(control.x,control.y,control.z, anchor.x,anchor.y,anchor.z);
			}
			world = new Matrix3D();
			
			container = new Sprite();
			container.x = stage.stageWidth/2;
			container.y = stage.stageHeight/2;
			addChild(container);
			container.addEventListener(Event.ENTER_FRAME, rotate);
			addChild(new Stats());
		}
		private function rotate(e:Event):void {
			world.appendRotation(0.5,Vector3D.X_AXIS);
			world.appendRotation(1.5,Vector3D.Y_AXIS);
			world.appendRotation(1,  Vector3D.Z_AXIS);
			var vout:Vector.<Number> = new Vector.<Number>();
			Utils3D.projectVectors(world,apexes,vout,uvt);
			container.graphics.clear();
			container.graphics.lineStyle(0.1,0xffffff,0.13);
			for (var i:uint = 0; i < hairNum; i++) {
				var sn:uint = i*4;
				container.graphics.moveTo(0,0);
				container.graphics.curveTo(vout[sn],vout[sn+1],vout[sn+2],vout[sn+3]);
			}
		}
	}
}