# Smooth spinning?

**URL:** https://forum.kirupa.com/t/smooth-spinning/186405
**Category:** Uncategorized
**Created:** [April 21, 2006, 1:47am UTC](https://forum.kirupa.com/t/smooth-spinning/186405 "2006-04-21T01:47:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jc\_](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@jc\_](https://forum.kirupa.com/u/jc_)
#### Post date: [April 21, 2006, 1:47am UTC](https://forum.kirupa.com/t/smooth-spinning/186405/1 "2006-04-21T01:47:54Z")

</div>

Hi All!

I’m trying to figure out how to make the following code spin smoother.  
Any ideas or suggestions would be appreciated.

TIA!

jc\_

here its…

Create a new movie FLA, 550 x 400  
Create a MovieClip on the stage named “spinner”

Paste this code on the timeline:

```auto

var leftBoundary:Number = 0;
var rightBoundary:Number = 550;
var topBoundary:Number = 0;
var bottomBoundary:Number = 400;
var boundaryHeight:Number = bottomBoundary-topBoundary;
var boundaryWidth:Number = rightBoundary-leftBoundary;
var quadrantSize:Number = boundaryWidth/2;
var centerPoint:Number = rightBoundary-quadrantSize;
//
this.onMouseMove = function() {
	if (_xmouse>leftBoundary && _ymouse>topBoundary && _xmouse<rightBoundary && _ymouse<bottomBoundary) {
		var panAmount = ((_xmouse-centerPoint)/quadrantSize)*100;
		_root.spinner._rotation = _root.spinner._rotation+(panAmount/5);
		trace(panAmount)
	} else {
		//
	}
};

```

This will spin the “spinner” MC according to the mouse position.  
If you move the mouse to the left or right it will spin in the opposite direction.

the problem…  
How to make the rotation Tween or Move more smoothly?

:h: 🍺

---

<div class="post-metadata">

### Author: ![slimer](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@slimer](https://forum.kirupa.com/u/slimer)
#### Post date: [April 21, 2006, 3:27am UTC](https://forum.kirupa.com/t/smooth-spinning/186405/2 "2006-04-21T03:27:00Z")

</div>

look into importing tweens and or easing. im not sure how it worked, i saw a prof using it and it made everything like buttah! ya gotta import em at the beginning of yur script  
import mx.transitions.Tween;  
import mx.transitions.easing.\*;

dont recall what was next

---

<div class="post-metadata">

### Author: ![jc\_](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@jc\_](https://forum.kirupa.com/u/jc_)
#### Post date: [April 21, 2006, 9:46pm UTC](https://forum.kirupa.com/t/smooth-spinning/186405/3 "2006-04-21T21:46:31Z")

</div>

bump 🙂
