Jump to content
Search Community

"Universal" support for radians (new plugin?)

Cloud Media Lab test
Moderator Tag

Recommended Posts

Hello GreenSock,

 

Lately, I've been getting into some projects that combine the Flash display list, the Starling framework, and the Away3D framework.

 

What a crazy mixed up world -- especially when it comes to rotation properties. As a Flash-based Stage3D framework, Away3D "sensibly" defaults to degrees (despite what some of my Unity guys might think of that). However, Starling kinda gums up the proverbial works by hopping to radians for expressions of rotation.

 

Granted, if an AS3 developer is using matrix transforms on a regular basis, radians are going to make some sense.

 

But for most Flash (and GreenSock) users migrating to Starling, this can be a challenge.

 

Perhaps we could register a new plugin that provides "useRadians:true" at the level of simple rotation tweens. I've enjoyed the convenience of "useRadians" on both the ShortRotationPlugin and the BezierPlugin, but when it comes to simple rotations (especially where ShortRotation is not applicable), the only solution I found has been to create custom unit-converting "myRotation" getter/setter on the custom class.

 

What is your suggestion? Maybe I'm missing something obvious, if so please rap my knuckle. Otherwise, might this call for a new plugin?

 

such as...

TweenMax.to(myStarlingSprite, 10, {radianRotation:{rotation:Math.PI*2}, repeat:-1, ease:Linear.easeNone}); // rotate the starling sprite '360 degrees' every 10 seconds

 

 

Link to comment
Share on other sites

I just posted 12.0.5 which has a new DirectionalRotationPlugin that does everything shortRotation did (including useRadians:true option), plus allows you to define particular directions like clockwise or counter-clockwise. The syntax is a little different - you use strings and append a suffix like "_short", "_cw", or "_ccw". Or you can just use a regular number and it'll tween as usual (you don't HAVE to define a direction). 

 

You can view the docs at: http://api.greensock.com/as/com/greensock/plugins/DirectionalRotationPlugin.html

 

Does this give you what you were looking for? It'd certainly be easy to create a RadianRotationPlugin, but I think it probably makes more sense to just tie into this one super-talented DirectionalRotationPlugin that'll handle whatever you throw at it. Agreed?

 

Download the latest files at http://www.greensock.com/?download=GSAP-AS3 (the download screen doesn't reflect that version yet - still waiting on a CDN refresh)

  • Like 1
Link to comment
Share on other sites

Sorry about that - I recompiled the .swc files but neglected to add DirectionalRotationPlugin to the build path last night. It should be fixed now - the new .swc files in the bonus zips should indeed have that new plugin now. Sorry about the confusion there. 

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