gTween beta 3: AS3 Code Tweening Library

I’ve just wrapped up beta 3 of gTween. It’s been a busy few weeks, and is just getting busier with the Korean Game Developer’s Conference, and Adobe MAX around the corner, so it’s not quite as well tested as I’d like, but it seems to be working without problem.

The main feature additions are support for 3D rotation with smartRotation (always rotates in the shortest direction), a rewrite of custom progress points to make them more robust and reliable, the addition of a global defaultEase property, and the ability to globally control what properties will be rounded.


Here’s the full list of beta 3 updates:

  • fixed a bug with smart rotation
  • added rotationProperties static property to specify properties to apply smartRotation to
  • fixed bug with proxy method calls not returning the return value (thanks to Matus Laco)
  • added a few semi colons 🙂 (thanks to Matus Laco)
  • roundValues renamed to useSnapping
  • added snappingProperties static property to specify properties to apply snapping to.
  • fixed a bug that could cause setSize to be called twice
  • fixed a problem with copyInitProperties firing too many times
  • made the data parameter on addProgressPoint optional
  • changed removeProgressPoint to accept an optional data parameter
  • rewrote the progress point logic, fixing a problem that would prevent progress point events from firing if more than one progress point was passed in a single tick.
  • progress points will no longer fire when doing manual positioning, including using position=value, beginning() and end().
  • made it so that autoHide only applies while tweening alpha. (thanks to Randy Troppman)
  • added a defaultEase static property, which allows you to define the default easing function for all new tweens (thanks to Quentin)
  • made linearEase a public static method
  • added useSetSize property to allow you to turn off the setSize behaviour if necessary (thanks to jwopitz)

You can read the documentation, and download the latest version of gTween by clicking here.

Grant Skinner

The "g" in gskinner. Also the "skinner".

@gskinner

23 Comments

  1. Nice work yet again. Why still a beta though – this is more than good enough for a full release. Don’t do a google on us…

  2. Thanks for the update. I’ve been enjoying your engine for a couple of weeks now and it’s been great.

    There’s one small thing that bugs me though … (I use FDT on Eclipse as my code editor) there seems to be an “error” in the class.

    At line 222 “protected static var ticker:ITicker;” conflicts with the declaration of “protected var ticker:ITicker;” at line 328.

    Perhaps you can change the latter to localTicker or tickerInstance or something. Just to prevent the confusion of FDT and the casual reader of your code 🙂

  3. Thanks for this Grant – with a beta this stable and usable, I can’t wait to see what I can do with the full release!

    Thanks again for all your hard work!

  4. Thanks for the defaultEase prop!

    Nice lib!

  5. Heya Grant,

    Just downloaded beta 3.

    When I add a progressPoint at position 0, it doesn’t appear to fire a progress event when I play the tween.

    If I add at 0.1 it does fire the event.

    Just wanted to see if you could replicate and if so whether this is a bug or not.

    Many thanks for a really great library.

    Toby

  6. Uhm … is there no SVN repo for this? Makes being up-to-date easier.

  7. Hi Grant,

    Does your wonderful class has a onComplete event like Tweener Class ????

  8. Hey i’ve used Tweener for my Papervision 3D gallery. Could you please check if you’ll have time?

    http://www.flashmoto.com/flash-galleries/papervision-3d-flash-gallery/

    Thanks,

    Dementrio

  9. Thanks Dementrio for that wonderful gallery

    But i was asking about does the Gtween class has something like Oncomplete event Like The Tweener class cause I don’t know how to for example to make another tween after the first one finished

  10. Nabeel,

    GTween includes both a number of events, including a COMPLETE event. It also includes a nextTween property that allows you to sequence tweens.

    For more info on events, you can view full API documentation included with the download, or online here:

    http://www.gskinner.com/libraries/gtween/docs/

    Or, check out the feature overview here:

    http://www.gskinner.com/blog/archives/2008/08/gtween_a_new_tw.html

  11. I’ve been using Tweener for a while now, but secretly looking for a smaller but still robust library to take it’s place. Looks like I finally found the one! Great work guys, I’m looking forward for the final 1.0 release!

    Andrew Christensen | http://blog.728media.com

  12. With the new release I’m having trouble using rotations. No matter if useSmartRotation set true or false, my rotations go mad.

    Is there an example how to properly use this feature?

  13. Ok, at least managed to get the old behavior back, by disabling smart rotaion in constructor.

    new GTween(target, 0.5, {rotationY:target.rotationY + 90}, {useSmartRotation:false} );

    Maybe the “smart problem” is related to Papervision3D.

  14. I still can’t understand why you didn’t just write a wrapper for the Go engine.

  15. Hey grant, as always awesome job! I did however encounter an error in B3 regarding alpha->0 and autohiding. for whatever reason the object in question never actually got its visibly set to false… traced it back to the line:

    if (hasAlphaAndVisible && _autoHide && destProperties[“visible”] != null)

    the destProperties[“visible”] != null bit always evaluates to null since I haven’t set the target visibilty. Now I can add into the props visible:false, but that kinda just seems silly with autohide already set to true…

    I changed the line to if ((hasAlphaAndVisible && _autoHide) || (hasAlphaAndVisible && destProperties[“visible”] == false)), and that seems to work as I expect.

    Great work!

    ~ JT

  16. Hi —

    This is a great app, however, I would love to see some examples on how to do rotation, especially “3d”.

    Thanks,

    Rich

  17. I can’t post!

  18. SirHenry – I haven’t been able to reproduce any problems, except I noticed that tweening both rotationY and height simultaneously in player 10 causes issues (but this appears to be either a player issue, or a fact of life with this scenario). Feel free to send me a sample of the problem if it persists.

    JT – good catch! This line should actually be:

    if (hasAlphaAndVisible && _autoHide && destProperties[“alpha”] != null) { _target.visible = (_target.alpha > 0); }

    Rich – all you need to do is tween a rotation property (in Flash Player 10 for 3D):

    var gTween:GTween = new GTween(foo,1.5,{rotationY:180,y:150},{autoReverse:true, delay:1, progressListener:handleProgress});

    Let me know if that doesn’t help.

  19. Grant,

    Thanks for Leading the way for Actionscripters around the world! You did a great job with the class. Here’s a preview of my first project implementing the Gtween class:

    http://www.albertkiteck.com/harris

    And I noticed some people had questions about how to use the class for animating filters – here’s a basic setup for doing that:

    var glow:GlowFilter = new GlowFilter(0xFF0000, 1, 10, 10, 4, 2, false, false);

    foo.filters=[glow]

    var gTween:GTween = new GTween(glow,2,{strength:1},{changeListener:handleProgress});

    function handleProgress(evt:Event):void {

    foo.filters=[glow]

    }

    Keep up the good work and thanks for sharing your Gtween with all of us!

    Albert Kiteck

    Flash/CSS/PHP Developer & Designer

    http://www.albertkiteck.com

  20. Hi

    I encountered similar little problem like SirHenry when tweening rotation properties say from 360 to 390 for example with useSmartRotation to true.

    it doesn’t tween like expected 30 degrees – it tween all around plus the 30 degrees.

    but ones getting around this with setting useSmartRotation to false…

    very nice Class by the way, thank you for that..

  21. Something to consider:

    endTransition calls dispatchEvent(new Event(Event.COMPLETE)), then does a check on nextTween.

    If someone is listening for the Complete event to modify that instance of GTween and add a new nextTween, that nextTween will be fired right away (before the completion of this instance’s new tweening).

  22. Hi im having Problems to understand the new snappingProperties. How to implement a Hash Table for snapping .y to a Pixel? Someone knows?

  23. Hi,

    I downloaded the library because of http://gotoandlearn.com/play?id=92, and it mentioned “Smart Rotation”, but it doesn’t seem to be working for me… If I click the item “at the end”, which is just to the left of my first sprite, it rotates the full way around, instead of the easier tween… any ideas?

    Thanks,

    –d

Leave a Reply

Your email address will not be published. Required fields are marked *