# curveTo circle

**URL:** <https://forum.kirupa.com/t/curveto-circle/55203>\
**Category:** flash\
**Created:** [June 22, 2004, 12:38am UTC](https://forum.kirupa.com/t/curveto-circle/55203 "2004-06-22T00:38:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eze](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@eze](https://forum.kirupa.com/u/eze)\
**Post date:** [June 22, 2004, 12:38am UTC](https://forum.kirupa.com/t/curveto-circle/55203/1 "2004-06-22T00:38:35Z")

</div>

The following code works and all, however iv been studying it and im stuck on a few things -

1. The **curveTo** command what do the first two coordinates relate too and what do the second set do, I thought the first are where the curve starts and the second where it ends?

2. The registration point, how come this.moveTo(X+r, y) works but move.To(x+r, Y+r) disforms the circle in a pircular way O\_o

3. If anyone has time a little explanation on the above problems would be greatly appreciated, more detail the better 🙂

```auto
MovieClip.prototype.drawCircle = function(r, x, y) {
    this.moveTo(x+r, y);
    a = Math.tan(22.5 * Math.PI/180);
    for (var angle = 45; angle<=360; angle += 45) {
        // endpoint:
        var endx = r*Math.cos(angle*Math.PI/180);
        var endy = r*Math.sin(angle*Math.PI/180);
// control:
        // (angle-90 is used to give the correct sign)
        var cx =endx + r*a*Math.cos((angle-90)*Math.PI/180);
        var cy =endy + r*a*Math.sin((angle-90)*Math.PI/180);
        this.curveTo(cx+x, cy+y, endx+x, endy+y);
    }
}
var c80 = this.createEmptyMovieClip("c", 1);
c80.lineStyle(3, 0xaaaaaa, 100);
c80.beginFill(0xcccccc, 100);
c80.drawCircle(80, 100, 100);
c80.endFill();

```

Even a little explanation for Math.cos and sin/tan would be helpful, i think for endx and endy they are converting radians to degrees? but **a** is doing what?

Thanks for your time,  
Josh.
