forked from: ケサランパサラン
drawPathを使っても、alphaの重ね合わせが無くなるだけとは…
// forked from Kay's ケサランパサラン
// drawPathを使っても、alphaの重ね合わせが無くなるだけとは…
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(width=465,height=465,frameRate=60,backgroundColor=0x000000)]
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 commands:Vector.<int> = new Vector.<int>();
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(0,0,0,control.x,control.y,control.z, anchor.x,anchor.y,anchor.z);
commands.push(1,3);
}
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);
container.graphics.drawPath(commands, vout);
}
}
}