# Easing rotation on button event

**URL:** https://forum.kirupa.com/t/easing-rotation-on-button-event/194063
**Category:** Uncategorized
**Created:** [July 20, 2006, 7:36am UTC](https://forum.kirupa.com/t/easing-rotation-on-button-event/194063 "2006-07-20T07:36:53Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![oxyde\_mac\_com](https://avatars.discourse-cdn.com/v4/letter/o/7c8e57/32.png) [@oxyde\_mac\_com](https://forum.kirupa.com/u/oxyde_mac_com)
#### Post date: [July 20, 2006, 7:36am UTC](https://forum.kirupa.com/t/easing-rotation-on-button-event/194063/1 "2006-07-20T07:36:53Z")

</div>

Hi,

I have a button and a MC. I want to achieve the following:

when I click on the button my MC rotate to 180degrees with an easing sin.  
when i click again on this button or and other button my MC go back to the  
original position with an easing sin.

this is where I am at so far but i cant get the MC to rotate gradually

MovieClip.prototype.rotation = function() {  
truc.onRelease = function() {  
if (this.bob == true) {  
bob.\_rotation += (180-this.\_rotation)/9;  
}else{  
bob.\_rotation += (180-bob.\_rotation)/9;  
}  
}

};  
bob.rotation();

also how to back to initial position using the same button?

cheers
