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: 1-2 code24

Get Adobe Flash player
by gupon 29 Apr 2010
/**
 * Copyright gupon ( http://wonderfl.net/user/gupon )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/kD6b
 */

// forked from mta9's 1-2 code24
// forked from mta9's 1-2 code23
package {
    import flash.display.MovieClip;
    public class Index extends MovieClip{
        public function Index() {
            var myCircle1:DrawCircle = new DrawCircle;
            var myCircle2:DrawCircle = new DrawCircle;
            
            myCircle1.x = 50;
            myCircle2.y = 200;
            
            addChild(myCircle1);
            addChild(myCircle2);
        }
    }
}

import flash.display.GraphicsPathCommand;
import flash.display.Shape;

class DrawCircle extends Shape{
	public function DrawCircle() {
		var cx:Number = 100;
		var cy:Number = 200;
		var r:Number = 50;
		
		var sin:Number = Math.sin( Math.PI / 4 ) * r;
		var cos:Number = Math.cos( Math.PI / 4 ) * r;
		var tan:Number = Math.tan( Math.PI / 8 ) * r;
		
		var commands:Vector.<int> = new Vector.<int>();
		var data:Vector.<Number> = new Vector.<Number>();
		
		with( GraphicsPathCommand ) {
			commands.push(
				MOVE_TO,
				CURVE_TO, CURVE_TO, CURVE_TO, CURVE_TO,
				CURVE_TO, CURVE_TO, CURVE_TO, CURVE_TO
			);
		}
		
		data.push(
			  r, 0,
			  r  , tan, sin, sin,
			  tan, r , 0, r,
			- tan, r , - sin, sin,
			- r  , tan, - r  , 0,
			- r  , - tan, - sin, -sin,
			- tan, - r , 0, - r,
			  tan, - r , sin, -sin,
			  r  , - tan, r, 0         	
		);
		
		for ( var i:int=0;i<data.length;i++ ){
			if ( i % 2 )
				data[i] += cy;
			else
				data[i] += cx;
		}
		
        graphics.lineStyle(2, 0x000000);
        graphics.drawPath( commands, data );       
    }
}

class circle{
	public var x:Number;
	public var y:Number;
	public var vx:Number;
	public var vy:Number;
	public var radius:Number;
}