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

Ths Sum of all Possibilities - 2D

a clone of artwork..
http://www.troika.uk.com/work/the-sum-of-all-possibilities-2/

drawing closed arc shape
http://www.pixelwit.com/blog/2008/12/drawing-closed-arc-shape/
/**
 * Copyright greentec ( http://wonderfl.net/user/greentec )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/pY1r
 */

package {
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Graphics;
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.events.Event;
    
    public class FlashTest extends Sprite {
        public var _bitmapData:BitmapData;
        public var _bitmap:Bitmap;
        
        public var circleArray:Array;
        public var velocityArray:Array;
        public function FlashTest() {
            // write as3 code here..
            
            stage.scaleMode = "noScale";
            
            _bitmapData = new BitmapData(465, 465, false, 0x292929);
            _bitmap = new Bitmap(_bitmapData);
            addChild(_bitmap);
            
            circleArray = [];
            var i:int;
            var shape:Shape;
            for (i = 0; i < 20; i += 1)
            {
                shape = new Shape();
                shape.graphics.beginFill(0xdddddd);
                DrawSolidArc(shape.graphics, 0, 0, 465 / 2 - (i + 0.5) * 10, 465 / 2 - i * 10, 0 / 360, 90 / 360, 20);
                shape.x = 465 / 2;
                shape.y = 465 / 2;
                addChild(shape);
                
                circleArray.push(shape);
            }
            
            velocityArray = [];
            for (i = 0; i < 20; i += 1)
            {
                velocityArray.push((i + 1) / 40);
            }
            
            addEventListener(Event.ENTER_FRAME, onLoop);
        }
        
        private function onLoop(e:Event):void
        {
            var i:int;
            var shape:Shape;
            for (i = 0; i < 20; i += 1)
            {
                shape = circleArray[i];
                shape.rotation += velocityArray[i];
            }
        }
        
        //
        // The DrawSolidArc function takes standard arc drawing
        // arguments but the "radius" has been split into 2 different
        // variables, "innerRadius" and "outerRadius".
        private function DrawSolidArc (g:Graphics, centerX:Number, centerY:Number, innerRadius:Number, outerRadius:Number, startAngle:Number, arcAngle:Number, steps:int):void
        {
            var twoPI:Number = 2 * Math.PI;
            //
            // How much to rotate for each point along the arc.
            var angleStep:Number = arcAngle/steps;
            //
            // Variables set later.
            var angle:Number, i:int, endAngle:Number;
            //
            // Find the coordinates of the first point on the inner arc.
            var xx:Number = centerX + Math.cos(startAngle * twoPI) * innerRadius;
            var yy:Number = centerY + Math.sin(startAngle * twoPI) * innerRadius;
            //
            // Store the coordiantes in an object.
            var startPoint:Object = {x:xx, y:yy};
            
            with (g)
            {
                // Used to convert angles to radians.
                
                //
                // Move to the first point on the inner arc.
                moveTo(xx, yy);
                //
                // Draw all of the other points along the inner arc.
                for(i=1; i<=steps; i++){
                    angle = (startAngle + i * angleStep) * twoPI;
                    xx = centerX + Math.cos(angle) * innerRadius;
                    yy = centerY + Math.sin(angle) * innerRadius;
                    lineTo(xx, yy);
                }
                //
                // Determine the ending angle of the arc so you can
                // rotate around the outer arc in the opposite direction.
                endAngle = startAngle + arcAngle;
                //
                // Start drawing all points on the outer arc.
                for(i=0; i<=steps; i++){
                    //
                    // To go the opposite direction, we subtract rather than add.
                    angle = (endAngle - i * angleStep) * twoPI;
                    xx = centerX + Math.cos(angle) * outerRadius;
                    yy = centerY + Math.sin(angle) * outerRadius;
                    lineTo(xx, yy);
                }
                //
                // Close the shape by drawing a straight
                // line back to the inner arc.
                lineTo(startPoint.x, startPoint.y);
            }
        }
    }
}