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

Animated Sunflower Seed Spiral

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

// 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.0001;
        }

        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();
             }
            
           
        }

    }
}