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: Animated Sunflower Seed Spiral

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

// forked from Quasimondo's Animated Sunflower Seed Spiral
// forked from Quasimondo's Sunflower Seed Spiral
package {
    import flash.events.Event;
     import flash.display.Graphics;
    import flash.display.Sprite;
    public class SunflowerSpiral extends Sprite {

        private var divergenceOffset:Number;

        public function SunflowerSpiral() {
           
            
            
            divergenceOffset = 0;
            stage.addEventListener( Event.ENTER_FRAME, render );
            
        }
        
        private function render( event:Event ):void
        {
            graphics.clear()    
            renderSpiral( 800, 3, 3, divergenceOffset);
            divergenceOffset += 0.01;
        }

        private function renderSpiral( count:int, radius:int, padding:int, offset:Number = 0 ):void
        {
        
            var g:Graphics = graphics;
            
            
            var x:Number = 200;
            var y:Number = 200;
            var divergence:Number = (137.50776 + offset ) / 180 * Math.PI;
            
            for ( var i:int = 1; i <= count; i++ )
            {
                var r:Number = (radius + padding) * Math.sqrt( i ) - radius * 0.3;
                var a:Number = divergence * i;
                g.beginFill(0x807d70);
                g.drawCircle( x + Math.cos( a ) * r, y + Math.sin( a ) * r, radius);
                g.endFill();
             }
            
           
        }

    }
}