forked from: 円を沢山書いてみた by wonderfl本
forked from 円を沢山書いてみた by wonderfl本 (diff: 7)
ActionScript3 source code
/**
* Copyright kazuyuki ( http://wonderfl.net/user/kazuyuki )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/eTF1
*/
// forked from kazuyuki's 円を沢山書いてみた by wonderfl本
// forked from kazuyuki's forked from: flash on 2010-2-7
// forked from kazuyuki's flash on 2010-2-7
package {
import flash.events.Event;
import flash.display.MovieClip;
public class FlashTest extends MovieClip {
public function FlashTest() {
for(var i=0; i<10; i++){
var centerX:int = Math.floor(Math.random()*300);
var centerY:int = Math.floor(Math.random()*300);
var r:int = Math.floor(Math.random()*400);
addChild(new DrawCircle(centerX,centerY,r));
}
}
}
}
import flash.display.MovieClip;
class DrawCircle extends MovieClip{
public function DrawCircle(centerX:int, centerY:int, r:int){
graphics.lineStyle(2,0x888888);
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);
}
}