# Circular Motion

**URL:** <https://forum.kirupa.com/t/circular-motion/57887>\
**Category:** flash\
**Created:** [July 17, 2004, 6:17am UTC](https://forum.kirupa.com/t/circular-motion/57887 "2004-07-17T06:17:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gopaldass](https://avatars.discourse-cdn.com/v4/letter/g/c77e96/32.png) [@gopaldass](https://forum.kirupa.com/u/gopaldass)\
**Post date:** [July 17, 2004, 6:17am UTC](https://forum.kirupa.com/t/circular-motion/57887/1 "2004-07-17T06:17:10Z")

</div>

:whistle: 'Allo folks,

Urm… can someone explain the logic of circular motion (them radians and degrees). I’ve found the code for it and modified it a bit to make it do what I want.

But I haven’t a clue as to how it works…:puzzle:

This is a slightly modified code taken from the Kirupa Tutorial.

xcenter = 0;  
ycenter =0;

[font=Courier New][size=2][color=#000080]onClipEvent[/color][/size][/font][font=Courier New][size=2][color=black] ([/color][/size][/font][font=Courier New][size=2][color=#000080]enterFrame[/color][/size][/font][font=Courier New][size=2][color=black]) {[/color][/size][/font]  
degree += 22.5;  
[font=Courier New][size=2][color=black]radian = (degree/180)\*[/color][/size][/font][font=Courier New][size=2][color=#000080]Math.PI[/color][/size][/font][font=Courier New][size=2][color=black];  
[/color][/size][/font][font=Courier New][size=2][color=#000080]this.\_x[/color][/size][/font][font=Courier New][size=2][color=black] = xcenter+[/color][/size][/font][font=Courier New][size=2][color=#000080]Math.cos[/color][/size][/font][font=Courier New][size=2]color=black\*100;  
[/color][/size][/font][font=Courier New][size=2][color=#000080]this.\_y[/color][color=black] = ycenter-[/color][color=#000080]Math.sin[/color]color=black\*100;  
}

The above code will change the position of the movieClip at every 22.5 degrees (thereby making sixteen distinct stops) and will trace a circle of radius 100 px.

Can anyone explain the trigo. concept behind the math equations? (I tried, I tell you… I really tried). :crying:

Thank ye…

/gopaldass/  
[/color][/size][/font]

---

<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:** [July 17, 2004, 6:47am UTC](https://forum.kirupa.com/t/circular-motion/57887/2 "2004-07-17T06:47:06Z")

</div>

It’s a formula to calculate a position on a circle, here with radius 100 and with the center {xcenter, ycenter}. Cutout from my explanation in the [Best of Kirupa thread](http://www.kirupaforum.com/forums/showthread.php?t=36907):

![](http://users.pandora.be/voetsjoeba/kirupa/trig/sincos.jpg)  
The sine of angle is the opposing side divided by the hypotenuse. The hypotenuse is the radius of the circle. So we can say that Math.sin(angle) = y/radius. So this means that Math.sin(angle)\*radius = y. Same goes for x. Math.cos(angle) = adjacent side divided by the hypotenuse. So Math.cos(angle) = x/radius. Which will lead us to Math.cos(angle)\*radius = x. Using this simple formula, we can calculate the position on a circle given the angle and the radius.
