Open ghost opened 11 years ago
There are a handful of other bugs in the latest implementation of the Timeline. I had submitted a pull request prior to the 0.8.5 release but it doesn't look like it made it in..
Ah, missed that. Will comment there...
I think we need to sort out exactly what should happen when .pingPong()
is enabled, here are 2 unclear aspects that come to mind:
I think once we nail these down, it will be easier to decide how to implement.
My 2¢: rewrite ci::Tween so it doesn't explicitly provide reversing and ping-ponging. Instead, give Tweens a playback_rate parameter and let people change it in the finishFn callback to enable reversing, ping-ponging, and more exotic effects. I understand this would cause issues for things like knowing the full duration of a tween or timeline, but I feel like it's simpler and more powerful.
EDIT: Maybe revisiting the timeline functionality for 0.8.7 would be reasonable.
(btw, I am the ghost who opened this issue under a now deleted account).
Just wanted to add that, while I think @sansumbrella's suggestion for playback rate parameter is worth thinking about, TweenLite accomplishes this by having a repeat count. If you add a yoyo()
, which is like our pingpong()
, then it will get a repeat count of 1, just enough to make its way back to the origin. If you set repeat = 10
, then you will get 5 'there and backs'.
Also worth pointing out that you (currently) can't get the same functionality by appending a similar tween but just with start and end value reversed, things like EaseOutExpo won't act right. So, we need something else. Another option would be to clone the Tween, and then add a method that tells it to play in reverse. This is pretty similar to @sansumbrella's proposal, although you'd still be able to gauge the full length of the tween / timeline.
My suggestion from before has been reified in Choreograph. That sample shows a bunch of different possibilities for repeating things, with the highlighted lines showing finite repetitions (7 and 1/2).
Would like to open up discussion at some point about switching Cinder's timeline library.
We've indeed talked about a v2, but nothing solid yet as there are a few other more important things to get through the pipeline first. Also other features have been mentioned, supporting things like thread safety or throwing other more complex types of things on the timeline (think audio, video, or skeletal animations). We're not really sure how feasible any of this is, but should be considered at the same time as api restructuring.
The following code seems like it should create an auto-reversing tween, i.e. fade in to 3x in 2 seconds, then back out:
It doesn't however. One can append
.autoRemove( false )
after.pingPong()
, but then the side effect is an infinite animation, not one single animation plus reverse.