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

ひまわりっぽいやつ

角度の黄金比分割とか 出展 - Nature by Number http://www.etereaestudios.com/movies/nbyn_movies/nbyn_mov_youtube.htm
Get Adobe Flash player
by keno42 27 Mar 2010
/**
 * Copyright keno42 ( http://wonderfl.net/user/keno42 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/fhx4
 */

// 角度の黄金比分割とか 出展 - Nature by Number http://www.etereaestudios.com/movies/nbyn_movies/nbyn_mov_youtube.htm
package 
{
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.filters.*;
    public class FlashTest extends Sprite {
        private var MAX_NUM:int = 3000;
        private var num:int = MAX_NUM;
        private var gv:Number = 0;
        private var ga:Number = 0;
        private var angle:Number = 0;
        private var firstP:Particle = new Particle();
        private var lastP:Particle = firstP;
        private var bmpData:BitmapData = new BitmapData(465,465,false,0x0);
        public function FlashTest() {
            // write as3 code here..
            this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
            addChild( new Bitmap( bmpData ) );
            shoot(firstP, angle);
        }
        private function onEnterFrame(e:Event):void{
            var p:Particle = firstP;
            var color:int = 0xFFFF00 | Math.ceil(0xFF * num / MAX_NUM);
            bmpData.lock();
            do {
                p.update();
                bmpData.setPixel(p.x, p.y, color);
            } while( p = p.next )
            bmpData.applyFilter(bmpData,bmpData.rect,new Point(),new BlurFilter(2,2));
            bmpData.unlock();
            if( num > 0 ){
                for( var i:int = 0; i < gv; i++ ){
                    num--;
                    var temp:Particle = new Particle();
                    angle += Math.PI * 137.5077 / 180;
                    shoot(temp, angle);
                    lastP.next = temp;
                    lastP = temp;
                    if( num == 0 ) break;
                }
                gv += ga;
                ga += 0.0002;
            }
        }
        private function shoot(p:Particle, angle:Number):void{
            p.x = 232;
            p.y = 232;
            p.vx = Math.sqrt(num) * Math.cos(angle) / (MAX_NUM / 1200);
            p.vy = Math.sqrt(num) * Math.sin(angle) / (MAX_NUM / 1200);
        }
    }
}

final class Particle
{
    public var x:Number;
    public var y:Number;
    public var vx:Number;
    public var vy:Number;
    public var next:Particle;
    public function update():void{
        x += vx;
        y += vy;
        vx *= 0.9;
        vy *= 0.9;
    }
}