# Creating the perfect circle

**URL:** <https://forum.kirupa.com/t/creating-the-perfect-circle/18344>\
**Category:** Uncategorized\
**Created:** [April 15, 2003, 6:35pm UTC](https://forum.kirupa.com/t/creating-the-perfect-circle/18344 "2003-04-15T18:35:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shuga](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@shuga](https://forum.kirupa.com/u/shuga)\
**Post date:** [April 15, 2003, 6:35pm UTC](https://forum.kirupa.com/t/creating-the-perfect-circle/18344/1 "2003-04-15T18:35:52Z")

</div>

using FlashMX’s drawing API here’s a simple way to create a perfect circle

you can store this fla and just copy the code into whatever you’re doing. change the variables and presto … you have a circle

the variables are commented so you should be able to easily figure out how you want to change them =)

i hope this is of use to someone

```php

_root.createEmptyMovieClip("circle", 500);
lcol = 0xFF0000;
// Line color
fcol = 0xFF9900;
// Fill color
lwid = 5;
// Line width
lal = 90;
// Line alpha
fal = 25;
// Fill alpha
x = 275;
// X-coordinate circle center
y = 200;
// Y - coordinate circle center
R = 100;
// Radius of circle
a = R*0.4086;
// Radius multiplied by constant
b = R*0.7071;
// Radius multiplied by constant
with (_root.circle) {
	lineStyle(lwid, lcol, lal);
	beginFill(fcol, fal);
	moveTo(x-R, y);
	curveTo(x-R, y-a, x-b, y-b);
	curveTo(x-a, y-R, x, y-R);
	curveTo(x+a, y-R, x+b, y-b);
	curveTo(x+R, y-a, x+R, y);
	curveTo(x+R, y+a, x+b, y+b);
	curveTo(x+a, y+R, x, y+R);
	curveTo(x-a, y+R, x-b, y+b);
	curveTo(x-R, y+a, x-R, y);
	endFill();
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 15, 2003, 7:00pm UTC](https://forum.kirupa.com/t/creating-the-perfect-circle/18344/2 "2003-04-15T19:00:19Z")

</div>

i see a little wavy line at top & bottom outline…:rd:  
but it’s cool…:player:

have u ever tried to make a rounded rectangle? if u be so kind…😛

i wonder how to animate this? from none to perfect circle??:q: (-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 15, 2003, 7:12pm UTC](https://forum.kirupa.com/t/creating-the-perfect-circle/18344/3 "2003-04-15T19:12:24Z")

</div>

i don’t see a wavy line anywhere

and no i haven’t tried to turn it into a rectangle. but that’ll be neat to try.

as far as animating … that’s a whole different matter b/c there are so many ways to animate it.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 15, 2003, 7:18pm UTC](https://forum.kirupa.com/t/creating-the-perfect-circle/18344/4 "2003-04-15T19:18:42Z")

</div>

:cool:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 15, 2003, 8:09pm UTC](https://forum.kirupa.com/t/creating-the-perfect-circle/18344/5 "2003-04-15T20:09:29Z")

</div>

its not perfect 😉

and you wont ever get a ‘perfect’ circle. Any circle made with the Drawing API in Flash, which uses quadratic bezier curves, will be an approximation, though the 8 curve approximation is more than plenty for the human eye.

For a curved box see [http://proto.layer51.com](http://proto.layer51.com)  
for animation search the forums (or [Macromedia.com](http://Macromedia.com), there is an article there with drawing api methods and means of animating them - or atleast altering their ‘position’ in the drawing via a value)
