Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] Engage and Disengage Virtual Timeline #12

Open
tungs opened this issue Mar 21, 2022 · 1 comment
Open

[FEATURE REQUEST] Engage and Disengage Virtual Timeline #12

tungs opened this issue Mar 21, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@tungs
Copy link
Owner

tungs commented Mar 21, 2022

Is your feature request related to a problem? Please describe.
There are some situations where I'd like to be able to engage or disengage the virtual timeline.

Describe the solution you'd like
I'd like there to be a function to call that switches from a virtual timeline to a realtime timeline. Events queued in the virtual timeline should then be transferred over to the realtime timeline and vice versa.

Describe alternatives you've considered
An alternative would be to simulate a realtime timeline by keeping the overwritten functions, but then also using a realtime requestAnimationFrame loop to measure an elapsed time, and use that time with timeweb.goTo.

Additional context
In addition to overwriting a window's and document's time handling functions back and forth, video elements would need to be significantly changed.

@tungs tungs added the enhancement New feature or request label Mar 21, 2022
@tungs tungs changed the title [FEATURE REQUEST] [FEATURE REQUEST] Engage and Disengage Virtual Timeline Mar 24, 2022
@tungs
Copy link
Owner Author

tungs commented Apr 4, 2022

v0.3.1 adds preliminary support for simulating realtime with timeweb.startRealtimeSimulation and timeweb.stopRealtimeSimulation. It works by creating an animation loop and then incrementing the virtual timeline based off of the time delta (or a fixed frame duration if supplied). This may be adequate in many use cases, however, there may be some unexpected behavior:

  • Currently time increments happen in steps after the realtime frames. This means that consecutive calls to Date.now will return the same time. An offset could be made using realtime times, but there should be some care when considering timeouts and time representation.

@tungs tungs self-assigned this May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant