forked from: Papervisionの勉強(パーティクルの作成)

by 1031no forked from Papervisionの勉強(パーティクルの作成) (diff: 2)
♥0 | Line 26 | Modified 2010-03-28 06:54:12 | MIT License
play

ActionScript3 source code

/**
 * Copyright 1031no ( http://wonderfl.net/user/1031no )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/ehLK
 */

// forked from matsu4512's Papervisionの勉強(パーティクルの作成)
package {
    import com.adobe.viewsource.ViewSource;
    
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    
    import org.papervision3d.materials.special.ParticleMaterial;
    import org.papervision3d.objects.special.ParticleField;
    import org.papervision3d.view.BasicView;

    [SWF(backgroundColor=0x000000, width = 800, height=800)]

    public class Papervision9 extends Sprite
    {
        public function Papervision9()
        {
           
            
            //初期設定
            var world:BasicView = new BasicView();
            world.startRendering();
            addChild(world);
            
            //生成するパーティクルの設定。色とアルファ値
            var particleMat:ParticleMaterial = new ParticleMaterial(0xFFFFFF, 1);
            //大きさ2000の立方体の中に大きさ4のパーティクルを500個生成
            var particles:ParticleField = new ParticleField(particleMat, 500, 2, 2000, 2000, 2000);
            
            world.scene.addChild(particles);
            
            
            
            addEventListener(Event.ENTER_FRAME, function():void{
                particles.rotationY -= (stage.mouseX - stage.stageWidth/2)/100;
                particles.rotationX -= (stage.mouseY - stage.stageHeight/2)/100;
            });
        }
    }
}