# Rotation Counter Clockwise

**URL:** https://forum.kirupa.com/t/rotation-counter-clockwise/186232
**Category:** flash
**Created:** [April 19, 2006, 11:17pm UTC](https://forum.kirupa.com/t/rotation-counter-clockwise/186232 "2006-04-19T23:17:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Balala](https://avatars.discourse-cdn.com/v4/letter/b/df705f/32.png) [@Balala](https://forum.kirupa.com/u/Balala)
#### Post date: [April 19, 2006, 11:17pm UTC](https://forum.kirupa.com/t/rotation-counter-clockwise/186232/1 "2006-04-19T23:17:33Z")

</div>

Hello guys,

im in a little trouble here =)

Have tried so many times to make this cannon turning other side, looking for formulas, maths, physics, but nothing works until now. So, here im to ask you one more time.

My code:

```auto
stop();

import mx.transitions.Tween;
import mx.transitions.easing.*;
easeTime = .5;

map.onRelease = function()
{
	angle_ini = tank_mc.tank_gfx._rotation;
	angle_end = Math.round(Math.atan2(tank_mc._ymouse, tank_mc._xmouse) * 180 / Math.PI);
	
	new Tween(tank_mc.tank_gfx, "_rotation", Regular.easeIn, angle_ini, angle_end, easeTime, true);
}

```

What do this do? Simple, when click on the map, i get the current angle of the turret, and rotate it to the clicked angle.

Whats the problem? Flash… Always, the flash 👼

Look the cartesian

_|_  
|

Top left: -180  
Top Right: 0

Bottom Left: 180  
Bottom Right: 0

So, if the tank angle is 170º, and i click on the top left area (-170) instead he go the way up (171, 172, 173, … 179, 180, -179, -178, … -170) it is goes all the way wrong.

Not wrong, but the way that the tween suppose to go. I see the senocular pizza tutorial, but not solve my problem… Anothers rotation question is only “be” at new rotate, not the rotation itself…

Demo: [http://www.fonix.com.br/main.swf](http://www.fonix.com.br/main.swf)

Thanks in advance

---

<div class="post-metadata">

### Author: ![Balala](https://avatars.discourse-cdn.com/v4/letter/b/df705f/32.png) [@Balala](https://forum.kirupa.com/u/Balala)
#### Post date: [April 19, 2006, 11:21pm UTC](https://forum.kirupa.com/t/rotation-counter-clockwise/186232/2 "2006-04-19T23:21:30Z")

</div>

Solved :bu:

Just changing some actions:

```auto
stop();

import mx.transitions.Tween;
import mx.transitions.easing.*;
easeTime = .5;

map.onRelease = function()
{
	angle_ini = tank_mc._rotation;
	angle_end = Math.round(Math.atan2(tank_mc._ymouse, tank_mc._xmouse) * 180 / Math.PI);
	
	new Tween(tank_mc, "_rotation", Regular.easeIn, angle_ini, (angle_ini + angle_end), easeTime, true);
}

```

I was rotating a movie clip inside the tank\_mc, and always getting the angle again from root, now, i only get the “rotate variation”

Anyway, if there is a way to solve the another way, i’ld appreciate :snug:
