# How does this work?

**URL:** <https://forum.kirupa.com/t/how-does-this-work/191486>\
**Category:** Uncategorized\
**Created:** [June 20, 2006, 10:21pm UTC](https://forum.kirupa.com/t/how-does-this-work/191486 "2006-06-20T22:21:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![woad](https://avatars.discourse-cdn.com/v4/letter/w/34f0e0/32.png) [@woad](https://forum.kirupa.com/u/woad)\
**Post date:** [June 20, 2006, 10:21pm UTC](https://forum.kirupa.com/t/how-does-this-work/191486/1 "2006-06-20T22:21:48Z")

</div>

Darn (except not that word) me and my curiosity. How does this work _exactly_ ? It was written by TheCanadian.

mc.[COLOR=#0000ff]onEnterFrame[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#000000] **var** [/COLOR] theta:[COLOR=#0000ff]Number[/COLOR] = [COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]atan2[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]\_ymouse[/COLOR] - [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]\_y[/COLOR], [COLOR=#0000ff]\_xmouse[/COLOR] - [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]\_x[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]\_rotation[/COLOR] = theta \* [COLOR=#000080]180[/COLOR] / [COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]PI[/COLOR];  
[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]\_x[/COLOR] += [COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]cos[/COLOR]COLOR=#000000[/COLOR] \* [COLOR=#000080]3[/COLOR];  
[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]\_y[/COLOR] += [COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]sin[/COLOR]COLOR=#000000[/COLOR] \* [COLOR=#000080]3[/COLOR];  
[COLOR=#000000]}[/COLOR];

I understand that it gets the angle from the mouse coordinates, but what about the rest? Why does it multiply by 180? And does all of this have something to do with radius’ and diameters because of the Math.PI? So many questions, so much time…
