traning-002

by ketatony
♥0 | Line 53 | Modified 2010-04-07 00:35:14 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.MovieClip;
    public class Index extends MovieClip {
 	   	public function Index () {
  	  		var repeatCount:int = 10;
   	 		
    			for(var i=0; i<repeatCount; i++) {
    				var centerX:Number = Math.round(Math.random()*400) + 50;
    				var centerY:Number = Math.round(Math.random()*400) + 50;
    				var r:Number = Math.ceil(Math.random()*100);
    				addChild(new DrawCircle(centerX, centerY, r));
    			}
    		}
    }
}

import flash.display.MovieClip;
class DrawCircle extends MovieClip {
	public function DrawCircle(centerX:Number, centerY:Number, r:Number) {
		graphics.lineStyle(7, 0x3366ff);
		graphics.moveTo(centerX+r, centerY);
		
		graphics.curveTo(r+centerX,
						Math.tan(Math.PI/8)*r+centerY,
						Math.sin(Math.PI/4)*r+centerX,
						Math.sin(Math.PI/4)*r+centerY);
						
		graphics.curveTo(Math.tan(Math.PI/8)*r+centerX,
						r+centerY,
						centerX,
						r+centerY);
						
		graphics.curveTo(-Math.tan(Math.PI/8)*r+centerX,
						r+centerY,
						-Math.sin(Math.PI/4)*r+centerX,
						Math.sin(Math.PI/4)*r+centerY);
		
		graphics.curveTo(-r+centerX,
						Math.tan(Math.PI/8)*r+centerY,
						-r+centerX,
						centerY);
		
		graphics.curveTo(-r+centerX,
						-Math.tan(Math.PI/8)*r+centerY,
						-Math.sin(Math.PI/4)*r+centerX,
						-Math.sin(Math.PI/4)*r+centerY);
						
		graphics.curveTo(-Math.tan(Math.PI/8)*r+centerX,
						-r+centerY,
						centerX,
						-r+centerY);
						
		graphics.curveTo(Math.tan(Math.PI/8)*r+centerX,
						-r+centerY,
						Math.sin(Math.PI/4)*r+centerX,
						-Math.sin(Math.PI/4)*r+centerY);
		
		graphics.curveTo(r+centerX,
						-Math.tan(Math.PI/8)*r+centerY,
						r+centerX,
						centerY);	
	}
}