I am using Rx to keep an animation clock. Every animation frame, it maps an interval tick to the new values for that tick.
Suppose I want to pause the animation. The most natural way would be to somehow suspend the clock rx and then resume it at a later time.
Unsubscribe then resubscribe isn't a natural fit, because this animation clock is a cold observable. I don't want to restart the animation when they resume. If I go for a workaround method, I will have to generate a new resume rx, vastly complicating all of the exposed APIs.
Backpressure methods don't seem promising:
pause
doesn't work, because I want to resume where I left off, not jump forward. In other words I don't want to drop ticks while it's off.
pausableBuffered
doesn't work, because on resume, it will drain all of the accumulated ticks as fast as it can.
Using some sort of a virtual time scheduler to completely stop time and then resume normal time might be possible(?)
I am on RxJS 5.0rc4, but I wouldn't know how to do this on RxJS 4, either. Any advice for either version would be appreciated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With