Search In
• More options...
Find results that contain...
Find results in...

# rotation, to=CW vs. From=CCW

## Recommended Posts

Hi Greensock

1. Why is 2 movieclips both rotated from -90 to 190 going cw using TweenMax.to and ccw using TweenMax.from?

2. Is there a way to make .from go CW in this example?

note: both going cw when var rotateTo <=180 in example below

//HippieSvin

```import com.greensock.easing.*;
import com.greensock.plugins.*;
import com.greensock.TweenMax;

var rotateTo:Number = 190;
var rotateFrom:Number = -90;

// CCW
// RED : TM animating FROM -90 to 190
var c1:MovieClip = new MovieClip();
c1.x = 275;
c1.y = 200;
c1.rotation=rotateTo;

var red:MovieClip = new boxRed();
red.x=-50;
TweenMax.from(c1, 3, { delay:1.0, rotation:rotateFrom, ease:Quad.easeInOut });

// CW
// GREEN : TM animating TO 190 from -90 : this goes CW
var c2:MovieClip = new MovieClip();
c2.x = 275;
c2.y = 200;
c2.rotation=rotateFrom;

var green:MovieClip = new boxGreen();
green.x=-50;
TweenMax.to(c2, 3, { delay:1.0, rotation:rotateTo, ease:Quad.easeInOut });
```
##### Share on other sites

If you want it to go in the shortest direction, use the shortRotation plugin. If you want it to go in a particular direction, you can use relative values. You'd need to do the math up front to figure out now many degrees you need it to go in the particular direction and then feed it in as a relative value. For example, if you want to go clockwise, make sure the value is increasing. To go 110 degrees clockwise, you'd do

```var dif:Number = 110;
TweenMax.to(mc, 3, {rotation:"+=" + dif});
```

And to go counter-clockwise, use a negative value, prefixing it with "-=".

##### Share on other sites

This works for me in Firefox, but in Chrome the rotated element starts walking away after every rotation.

##### Share on other sites

Hi RonK,

I'm a little confused. We have never had an issue with Flash Player handling basic code like this differently depending on browser.

Is it possible this is an HTML5 / JS issue? I'm guessing that you posted in our Flash Archive accidentally.

If so, can you please post a new topic in our HTML5 forums with a very simple CodePen demo so that we can easily test your code in different browsers and quickly offer a solution.

If this is truly a Flash / ActionScript problem, please provide a very basic FLA that we can look at. Zip it and attach it to this post using the "more reply options" button.

Thanks!

• 1

## Create an account

Register a new account