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: オッス、おらロク!

import net.hires.debug.Stats;
Get Adobe Flash player
by ohisama 11 Jan 2013
/**
 * Copyright ohisama ( http://wonderfl.net/user/ohisama )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/aruR
 */

// forked from buccchi's オッス、おらロク!
package 
{
    import flash.events.Event;
    import org.papervision3d.view.BasicView;
    import org.papervision3d.render.BasicRenderEngine;
    import org.papervision3d.objects.parsers.DAE;
    import org.papervision3d.core.render.filter.FogFilter;
    import org.papervision3d.materials.BitmapFileMaterial;
    import org.papervision3d.materials.special.FogMaterial;
    //import net.hires.debug.Stats;
    
    public class FlashTest extends BasicView 
    {
        private var rot : Number = 0;
        private var camY : Number = 0;
        private var camD : Number = 0;
        private var mountains : Array;        
        public function FlashTest() : void 
        {
            //addChild(new Stats());           
            var roku : DAE = new DAE();
            roku.load("http://buccchi.jp/wonderfl/201002/roku.dae");
            scene.addChild(roku);
            roku.scale = 100;
            roku.y = -200;            
            mountains = new Array();
            for (var i : uint = 0; i < 10; i++)
            {
                var mountain : DAE = new DAE();
                mountain.load("http://buccchi.jp/wonderfl/201002/mountain.dae");
                scene.addChild(mountain);
                mountain.x = i * 2300;
                resetMountain(mountain);
                mountains.push(mountain);
            }            
            var fg : FogMaterial = new FogMaterial(0xFFFF00);
            renderer.filter = new FogFilter(fg, 50, 5000, 20000);
            startRendering();
            addEventListener(Event.ENTER_FRAME, loop);
        }
        private function loop(e : Event) : void
        {
            rot -= .5;
            camY += .01;
            camD += .007;
            var h : Number =  Math.sin(camD) * 500 + 1500;
            camera.x = h * Math.sin(rot * Math.PI / 180);
            camera.z = h * Math.cos(rot * Math.PI / 180);
            camera.y = Math.cos(camY) * 600 + 100;
            for (var i : uint = 0; i < mountains.length; i++)
            {
                if (mountains[i].x > 12000)
                {
                    mountains[i].x -= 24000;
                    resetMountain(mountains[i]);
                }
                else
                {
                    mountains[i].x += 60;
                }
            }
        }
        private function resetMountain(dae : DAE) : void 
        {
            dae.y = -Math.random() * 400 - 1800;
            dae.z = (Math.random() < .5)? Math.random() * 5000 + 1000 : Math.random() * -5000 - 1000;
            dae.scale = Math.random() * 40 + 150;
            dae.scaleY = Math.random() * 120 + 80;
            dae.rotationY = Math.random() * 360;
        }
    }
}