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: 黄金角を使ったひまわりの種の配置

Get Adobe Flash player
by 28inch 22 Jun 2012
    Embed
/**
 * Copyright 28inch ( http://wonderfl.net/user/28inch )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/kXxz
 */

// forked from Hiroshi.Ogawa's 黄金角を使ったひまわりの種の配置
package
{
    import flash.display.Shape;
    import flash.display.Sprite;
    public class sunFlower extends Sprite 
    {
        private var centerX:Number = stage.stageWidth / 2;
        private var centerY:Number = stage.stageHeight / 2;
        private var deg:Number;
        private var radius:Number = 200;
        private var numbers:Number = 700;
             
        public function sunFlower():void
        {
            init();
        }
         
        private function init():void
        {
            var line:Shape = new Shape();
            addChild(line);
            line.graphics.lineStyle(1, 0, 1, true, "normal", "none");
             
            deg = ((1 + Math.sqrt(5)) / 2) * 360 - 360;
            for (var i:uint = 0; i < numbers; i++)
            {
                setCircle(i);
            }
        }
         
        private function setCircle(n:Number):void
        {
             
            var circle:Shape = new Shape();
            addChild(circle);
            circle.x = Math.cos(deg  * Math.PI / 180 * n)  * radius/numbers * n + centerX;
            circle.y = Math.sin(deg  * Math.PI / 180 * n)  * radius/numbers * n + centerY;
            circle.graphics.lineStyle(1, 0x000000);
            circle.graphics.drawCircle(0, 0, 2);
            circle.graphics.endFill();
        }
    }
     
}