Jump to content
Search Community

BezierPlugin not orienting to path

flashgoblin test
Moderator Tag

Recommended Posts

I'm trying to use BezierPlugin to make my Starling sprite follow a bezier path and have it orient to the path. I'm using the following code...

 

TweenMax.to(mc, 3, {bezier:[{x:209, y:126}, {x:149, y:348}, {x:300, y:345}], orientToBezier:true});

 

...but my sprite rotates violently around it's pivot point and not along the path.

 

Any thoughts?

 

Thanks!

 

-Shane

Link to comment
Share on other sites

I believe the issues is that Starling uses radians for rotation instead of degrees. I assume you're using v11.x of TweenMax - the orientToBezier:true assumes degrees. I highly recommend that you upgrade to using v12 so that you can tap into the much improved BezierPlugin which allows you to use radians. "orientToBeizer" has been renamed "autoRotate" and you can optionally pass an array of values that control the rotation. See the docs at:

http://api.greensock.com/as/com/greensock/plugins/BezierPlugin.html

 

For example, your tween may look like this:

 

TweenMax.to(mc, 3, {bezier:{values:[{x:209, y:126}, {x:149, y:348}, {x:300, y:345}], autoRotate:[color=#000000][font='Lucida Console', 'Courier New', Courier, monospace][size=3]["x","y","rotation",0,true][/size][/font][/color]}});

 

But again, this assumes you're using v12 of TweenMax which you can read about at http://www.greensock.com/v12/

 

There's some more info about the new BezierPlugin at http://forums.greensock.com/topic/6395-poll-bezierplugin-new-features-and-types/

 

Does that clear things up?

Link to comment
Share on other sites

  • 8 months later...

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...