# \[MX\] Smooth rotation

**URL:** https://forum.kirupa.com/t/mx-smooth-rotation/164115
**Category:** flash
**Created:** [September 28, 2005, 5:36pm UTC](https://forum.kirupa.com/t/mx-smooth-rotation/164115 "2005-09-28T17:36:32Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Favardin](https://avatars.discourse-cdn.com/v4/letter/f/f08c70/32.png) [@Favardin](https://forum.kirupa.com/u/Favardin)
#### Post date: [September 28, 2005, 5:36pm UTC](https://forum.kirupa.com/t/mx-smooth-rotation/164115/1 "2005-09-28T17:36:32Z")

</div>

Am I the only one who hates the \_rotation property? Why would someone prefer -180 to 180 degrees instead of nice 0 to 360? Oh, I’m ranting…

Well, I planned doing a little script to have a movieclip rotate to point towards the mouse cursor. No prob so far, the code looks like this (onEnterFrame handle):

```auto

  var dx = _root._xmouse - this._x;
  var dy = _root._ymouse - this._y;	
	
  var angle = Math.atan2(dx,dy);
	
  this._rotation = -(angle/Math.PI * 180);

```

But then I wanted to ease the motion, so that the moviclip rotates towards the cursor instead of jumping directly to the right position. But that’s where the trouble started - I tried simply to add the rotation and the targeted angle and divide the sum by a constant, but It just wouldn’t work. Somehow I just can’t get the strange behaivor of the \_rotation property into my head - any tips?
