Closed Beeblerox closed 8 years ago
How would this look like?
haven't decided yet. this issue is just a note, since it has been discussed on Skype conference
What current options have you considered? Here's a couple:
FlxTween.chain([FlxTween.tween(blah), FlxTween.tween(blah), FlxTween.tween(blah)])
Or perhaps (returning an array of tweens):
FlxTween.tween(blah).thenTween(blah).thenTween(blah);
Return an array of tweens?
@Gama11 FlxTween.tween() lets you keep a reference to the tween. This would not be possible with the second structure as there is no single tween to return. It is easy enough to have thenTween() pass an array to each next tween such that thenTween() can return an array of all the tweens in the chain. This is just so the user has some way to keep a reference to the tween objects should they need it.
I see, makes sense.
I think I like the first option better.
+1 for chaining like this:
FlxTween.tween().tween().onComplete().tween();
The first way is more standard, the second way is a little less cumbersome to type, but is also a lot more flexible.
I prefer the second chaining way. As @Tiago-Ling pointed out, you can also having things like .onComplete() using this syntax, also reducing the brace complexity. Other options include things like adding simultaneous tweens.
Perhaps, rather than returning an array of tweens, it would be better to have a FlxTweenGroup or FlxTweenChain, which can be stopped, canceled, and looped in the same way a single tween can.
In fact, this syntax could potentially completely replace the existing tweenoptions object, which is a pain with autocomplete, and generally looks ugly.
Delays could be done as such:
FlxTween.delay(2).tween(blah).delay(2).tween(blah).onComplete(blah).loopAll();
I also threw in a potential way to make the whole sequence loop. xD Look at the control you could have. :) Note that this would also be possible with the other tween methods.
Tweenlite lib uses a TimeLine(Lite) to manage tweens, an internal one to manage tweens in general and then you can make your own for more control. First image is a big timeline. That would solve the array of tweens thing, though it's kinda major to add in.
I'm not sure that the features added allow you to loop the chain as a whole, is that right?
Yeah, I don't think that's possible right now.
it can be done only with tween onComplete() now, which isn't very good