Jump to content
Search Community

rotation, to=CW vs. From=CCW

Hippiesvin test
Moderator Tag

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();
this.addChild(c1);
c1.x = 275;
c1.y = 200;
c1.rotation=rotateTo;

var red:MovieClip = new boxRed();
c1.addChild(red);
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();
this.addChild(c2);
c2.x = 275;
c2.y = 200;
c2.rotation=rotateFrom;

var green:MovieClip = new boxGreen();
c2.addChild(green);
green.x=-50;
TweenMax.to(c2, 3, { delay:1.0, rotation:rotateTo, ease:Quad.easeInOut });
Link to comment
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 "-=". 

Link to comment
Share on other sites

  • 3 years later...

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!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...