program for Drawing a Circle - Code

Latest

programs

Friday, October 7, 2011

program for Drawing a Circle


 Drawing a Circle
------------------------------


function drawcircle(r,x,y)
{
this.createEmptyMovieClip("circle_mc",1);
with(circle_mc)
{
var angle=Math.PI/4;
var d=r/Math.cos(angle/2);
var angle1=0;
var rx,ry,ax,ay;
this.moveTo(x+r,y);
for(var i=0;i<8;i++)
{
angle1+=angle;
rx=x+Math.cos(angle1-(angle/2))*d;
ry=y+Math.sin(angle1-(angle/2))*d;
ax=x+Math.cos(angle1)*r;
ay=y+Math.sin(angle1)*r;
this.lineStyle(0,0x0000FF,100);
this.curveTo(rx,ry,ax,ay);
}
}
}
drawcircle(100,100,100);

No comments:

Post a Comment