Go 0.4.7 Drops!
So far, GoASAP has grown into being a solid Animation Platform with a coherent Core Compatibility layer and a highly evolved animation engine and linear-tweening base system. No physics classes yet, but the architecture leaves plenty of room for that to grow.
The latest drop, GoASAP 0.4.7 is a major improvement in the tweening arena, adding a “useFrames” alternative to time-synced updates and more cycling options. Looping has also been added to group & sequence utilities. This update also affects any LinearGo extensions you’ve already written so be sure to read this article!
New Event Types
GoEvent has some new types: PAUSE, RESUME, and CYCLE (cycle is between loops or back-and-forth cycling animations). These events are now dispatched from LinearGo, PlayableGroup and all Go Sequence utils.
Repeater Repeater
To handle looping and cycling, LinearGo, PlayableGroup and all Sequence classes now contain a property called repeater. The property holds an instance of an iterator object – for groups and sequences this is simply a Repeater, and for LinearGo it is a LinearGoRepeater. You can set the repeater’s cycles property to any uint higher than 1 to make these “playables” repeat their play. For example:
myGroup.repeater.cycles = 2;
mySequence.repeater.cycles = Repeater.INFINITE;
LinearGo’s special repeater has more options. Its property reverseOnCycle is true by default, which means that a tween will cycle back and forth in a ‘yoyo’ motion. If you set that property to false the tween will loop forwards. One problem with back-and-forth tweens is that easing tends to look bad one way or the other. So LinearGoRepeater also lets you set easingOnCycle. (It also has an extraEaseParams parameter like LinearGo does, for easing functions like Elastic and Back that take more than 4 inputs.) So to make a tween play forward then back in a smooth arc you could set the tween’s easing to a strong ease-out, then set myTween.repeater.easingOnCycle to a similar ease-in.
Like everything else in GoASAP, repeaters are made to be universal and extensible. As you create your own Go utilities, you can make use of this simple iterator object to help you implement complex functionality. For example, Repeater’s skipTo() method will calculate jumps across cycles and return a new position value for you.
“Frames” Support for Tweens
The ability to tween in frames instead of seconds was the last big one to fall. It’s not a recommended feature, since normally tweens sync to realtime which is a lot more accurate and intuitive. Frames work like the timeline, they will slow down your animation if the player is lagging.. but in special cases such as syncing to a timeline animation you might need to use it.
Surprisingly enough, it didn’t add too much complexity or slow LinearGo down. “Frames” are actually update-counts, so when you set:
mytween.useFrames = true;
… you’re really stating that you want delay and duration to be treated as the number of times the tween is updated on its pulse.
Normally you want the pulse to be synced to the player, which you can do by setting:
GoItem.defaultPulseInterval = GoEngine.ENTER_FRAME;
Or by setting your tween’s pulseInterval individually. But this can be a hassle if you simply want to work in a frames metaphor for a whole project. If that’s the case, simply call this setup command once at the beginning of your program:
LinearGo.setupUseFramesMode();
This changes the default pulse to ENTER_FRAME and makes all new LinearGo instances default to useFrames. This method also provides the option to switch to a zero-based index, instead of using a 1-based frame index like the Flash timeline.
The new currentFrame getter always steps forward through delay, duration, and all cycles (as if cycled tweens were back-to-back tweens in a timeine),
The timePosition getter also works in frames mode – works the same as in time mode. That property’s values always range between negative-delay and zero during the delay; then zero to duration during all cycles. So during cycles this property acts more like a timeline playhead that loops in a single tween.
Critical Update Warning!
Sorry to sound like the Window OS there but, you need to know that if you’ve been writing subclasses of LinearGo this update will force you to tweak them just a tiny bit, because LinearGo’s constructor inputs have changed. It is also now mandatory that your subclasses make a super() call, since LinearGo’s constructor instantiates the repeater instance and adjusts class defaults.
Other non-critical items in this version include a new EasingFormatError for use with malformed easing functions, and a few minor improvements to PlayableGroup’s internals.
Enjoy!
All classes and documentation available from the GoASAP website.
Filed under: Go by mosesoak
[...] GoASAPのことはMoses Guneschさんのblog「Go」をご覧下さい。 Actionscript3 GoASAP, LinearGo, LinearGoRepeater « LinearGoRepeaterでtweenを繰返し GoASAP, LinearGoでtweenしてみる » [...]