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: Tunnel, forked from: 虹色幾何学模様

blog : http://tirirenge.undo.jp/?p=1726
*
* こちらを参考にして虹色のグラデーションできました!thx!
* http://wonderfl.kayac.com/code/2039da32bb0346bf7bd7723e75492995841be82a
// forked from advancedhandkeytarfingerwizard's Tunnel, forked from: 虹色幾何学模様
// forked from ahchang's 虹色幾何学模様
// forked from ahchang's forked from: forked from: forked from: とりあえずCircleを描いてみた
// forked from ahchang's forked from: forked from: とりあえずCircleを描いてみた
// forked from soundkitchen's forked from: とりあえずCircleを描いてみた
// forked from ahchang's とりあえずCircleを描いてみた
/**
* blog : http://tirirenge.undo.jp/?p=1726
*
* こちらを参考にして虹色のグラデーションできました!thx!
* http://wonderfl.kayac.com/code/2039da32bb0346bf7bd7723e75492995841be82a
**/

package
{
    import flash.display.Sprite;
    import frocessing.color.ColorHSV;
    import flash.display.Graphics;
    import flash.display.Shape;
    import flash.events.Event;
    
    [SWF(width=465, height=465, frameRate=60, backgroundColor=0x000000)]
    
    public class CircleBasic extends Sprite
    {
        public static const NUM_CIRCLES:uint = 150;
        public static const SPIN_FACTOR = Math.PI;
        
        private var radius:Number;
        private var posX:Number;
        private var posY:Number;
        private var nAngle:Number;
        private var cAngle:Number;
        private var cx:Number, cy:Number;
        private var hsv:ColorHSV;
        
        private var frame:int;
                
        public function CircleBasic()
        {
            init();
        }
        
        private function init():void {
            this.stage.frameRate = 1;
            frame = 0;
            
            this.radius = 0;
            posX = stage.stageWidth /2;
            posY = stage.stageHeight /2;
            this.x = posX;
            this.y = posY;
            
            nAngle = Math.PI * 2 / (NUM_CIRCLES*SPIN_FACTOR);
            cAngle = 0;
            
            render(0);
            addEventListener(Event.ENTER_FRAME, step);
            
            Wonderfl.capture_delay( 1 );
        }
        
        private function render(fn:int):void
        {
            //rendering = true;
            graphics.clear();
            
            for (var i:uint=0; i<(NUM_CIRCLES); i++)
            {
                radius = (Math.cos(frame)*3500/i);
                cx = Math.cos(cAngle) * radius/2;
                cy = Math.sin(cAngle) * radius/2;

                hsv = new ColorHSV(0, 1, 1, 1);
                hsv.h = cAngle / Math.PI * 180;
                hsv.v = i/NUM_CIRCLES;
                hsv.s = (frame%NUM_CIRCLES)/NUM_CIRCLES;
                
                cAngle += nAngle+frame;//+i/SPIN_FACTOR;
                                
                graphics.drawCircle(cx, cy, radius);
                graphics.lineStyle(1, hsv.value, hsv.a);
            }
        }
        
        private function step(event:Event):void {
            render(frame++);
        } 
    }
}