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

arc

めがちかちかする
Get Adobe Flash player
by Scmiz 15 Apr 2011
/**
 * Copyright Scmiz ( http://wonderfl.net/user/Scmiz )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/1OeM
 */

package {
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            var sprite:Sprite = new Sprite();
            sprite.x = 232.5;
            sprite.y = 232.5;
            
            var centerX:Number = 0;
            var centerY:Number = 0;
            var radius:Number = 360.0;
            var num:uint = 12;
            var step:Number = 360.0 / num;
            var split:uint = 12;
            var layer:uint = 32;
            for (var index:uint = 0; index < num; ++index ) {
                    drawStripeArc(sprite, (index % 2 == 0), centerX, centerY, radius, step * index, (step * index) + step + 5, split, layer);
            }
            this.addChild(sprite);
            
            this.addEventListener(Event.ENTER_FRAME, function(e:Event):void{
                sprite.rotationZ += 6;
            });
        }
        
        private function drawStripeArc(sprite:Sprite, outBlack:Boolean, x:Number, y:Number, radius:Number, startDeg:Number, endDeg:Number, split:uint, layer:uint):void {
            for (var index:uint = 0; index < layer; ++index) {
                var color:uint = 0x000000;
                if (outBlack) {
                    if ((index % 2) == 1) color = 0xffffff;                
                }
                else {
                    if ((index % 2) == 1) color = 0x000000;                
                    else color = 0xffffff;
                }

                sprite.graphics.beginFill(color);
                drawArc(sprite, x, y, radius * (1.0 - (index / layer)), startDeg, endDeg, split);
                sprite.graphics.endFill();                
            }
        }

        
        private function drawArc(sprite:Sprite, x:Number, y:Number, radius:Number, startDeg:Number, endDeg:Number, split:uint):void {
            sprite.graphics.moveTo(x, y);
            for (var index:uint = 0; index < split; ++index) {
                var deg:Number = -(startDeg + ((endDeg - startDeg) * (Number)(index / split)));
                var rad:Number = (Math.PI * 2 * deg) / 360;
                sprite.graphics.lineTo(x + (Math.cos(rad) * radius), y + (Math.sin(rad) * radius));
            }
            sprite.graphics.moveTo(x, y);
        }
    }
}