Closed AndyOGo closed 8 years ago
Thanks! We're also thinking about how to add support for something on these lines too, so we'll have a look at your solution too.
I also need this, and ecstatic to learn that this ticket is 2 years old, @sole
There are so many other tweening libraries available now, if this feature is needed so badly why not just use a different one? This for example: http://www.greensock.com/gsap-js/ (which claims, although I've never verified it, to be significantly faster than the competition too)
Thanks for your interest! I'm sorry this hasn't been resolved in two years, but I guess no one has needed it so badly as to implement it and sending a PR, and etc etc.
The "problem" we have now is that the library does more things now than two years ago, so adding this might not be trivial. I personally haven't had this need, so I haven't really attempted to implement it either.
In short--sorry, but no one has done it yet. If someone does it nicely I will merge it in. Otherwise, maybe use other libraries as @photonstorm says :-)
Also anyone reading is welcome to use our implementation of tween.js too:
https://github.com/photonstorm/phaser/tree/master/src/tween
You'd have to remove a couple lines of Phaser specific code, but otherwise we added full pause / resume support (linked into a central game clock so the times update accurately), pauseAll/resumeAll functions and more importantly we split tween creation / destruction across 2 arrays. This resolves the issue tween.js has where if you nuke a tween during a custom callback (or as part of a chain) it throws reference errors in the main update loop.
Wow @photonstorm, if that wasn't a sales pitch I don't know what it was :-P
We recently solved some issues with stopping tweens so maybe that's what you mention...
(this conversation is getting derailed)
fyi I basically implemented this the same way @photonstorm except externally to the tween library. I didn't know tweenjs could take a time for update()
(not documented). When my code pauses, I just store a pause time, and on resume store how long we were paused for, and update tween with the timestamp as if nothing ever happened. Creates some minor jumps on pausing / resuming probably due to minor timing differences but works for my needs
Why don't you fork and pull a merge for this?
Actuallay I needed such a function for my project. So I decided to add such functionality.
Hope this is usefull. Maybe it could get improved, for example with progressbar. Rewind, fast forward functions an so on. Just an idea