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

forked from: Native3D Particle Test

大きさを3×3にして、一部色を変えた。
フレームレートを上げる反面、ゆっくり回転させるようにした。
Get Adobe Flash player
by tsu_droid 16 Oct 2011
    Embed
/**
 * Copyright tsu_droid ( http://wonderfl.net/user/tsu_droid )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/py88
 */

// forked from bradsedito's Native3D Particle Test
package {
 
import flash.geom.*;
import flash.display.Bitmap
import flash.display.BitmapData
import flash.display.DisplayObject
import flash.display.Sprite
import flash.events.Event 
 
[SWF(width="465", height="465", frameRate="50", backgroundColor="0x000000")]
 
public class ParticlesField extends Sprite 
{ 
    public var stars:Sprite = new Sprite()
    public var pointsVector:Vector.<Vector3D> = new Vector.<Vector3D>()
    protected var iter:int
    public var particleIro:int;// 色用変数
 
    public function ParticlesField() 
    {
        addParticles() 
        addChild( stars ) 
        addEventListener(Event.ENTER_FRAME, frameListener)
    };
 
    public function addParticles():void
    {
        for(iter=0; iter<800; iter++) {
 
            pointsVector.push(new Vector3D(Math.random()*800 - 400, Math.random()*500 - 250, Math.random()*900 - 450) )
 
             // 色の指定
            if(iter%51==0){
                particleIro = 0xaa66FFFF;
             } else if(iter%101==0){
                particleIro = 0xaaFF66FF;
             } else {
                particleIro = 0xaaFFFFFF;
             } 
             
            var tempStarData:BitmapData = new BitmapData(3, 3, true, particleIro)
            var tempStar:Bitmap = new Bitmap(tempStarData)//Star_1()//Bitmap(tempStarData)
            tempStar.x = pointsVector[iter].x
            tempStar.y = pointsVector[iter].y
            tempStar.z = pointsVector[iter].z
            tempStar.rotationY+= Math.round( Math.random()*800 )
            stars.addChild( tempStar )
        }
        stars.x = 300
        stars.z = 500
        stars.y = 150
    };
 
    protected function frameListener(evt:Event):void{
        stars.rotationY+=0.2;
    };
}
}