Beautifl - Flash Gallery

Thumbnail : PV3Dその9 ほし
PV3Dその9 ほし
sakef 2009-08-27 MIT License

再生するにはFlash Playerが必要です。デスクトップのブラウザでご覧ください。

// 星です。
package
{
    import flash.events.Event;
    import flash.filters.BlurFilter;
    import org.papervision3d.core.effects.BitmapLayerEffect;
    import org.papervision3d.core.effects.utils.BitmapClearMode;
    import org.papervision3d.core.geom.Pixels;
    import org.papervision3d.core.geom.renderables.Pixel3D;
    import org.papervision3d.view.BasicView;
    import org.papervision3d.view.layer.BitmapEffectLayer;

    [SWF(width="465", height="465", backgroundColor="0x000000", frameRate="40")]
    public class Main extends BasicView
    {
        private var pixels:Pixels;

        public function Main()
        {
            super(0, 0, true, true);
            var layer:BitmapEffectLayer=new BitmapEffectLayer(viewport, 500, 500, true, 0, BitmapClearMode.CLEAR_PRE, true);
            viewport.containerSprite.addLayer(layer);
            layer.addEffect(new BitmapLayerEffect(new BlurFilter(8, 8, 4), false));
            pixels=new Pixels(layer);
            scene.addChild(pixels);
            
            for(var t:Number=0; t < Math.PI * 2; t+=0.1){
                for(var s:Number=0; s < Math.PI * 2; s+=0.1){
                    var p:Pixel3D=new Pixel3D((0xff << 24 | 0xff*Math.random() << 16 | 0xff << 8 | 0xff*Math.random()), (4 - Math.cos(t) - Math.sin(5 * s)) * Math.cos(s) * 80, (4 - Math.cos(t) - Math.sin(5 * s)) * Math.sin(s) * 80, Math.sin(t) * 50);
                    pixels.addPixel3D(p);
                }
            }
            addEventListener(Event.ENTER_FRAME, onFrame);
        }

        private function onFrame(e:Event):void
        {
            singleRender();
            pixels.rotationX = pixels.rotationY++;
        }
    }
}