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

d3.stop() should return the time it was stopped at #51

Open
tansanDOTeth opened this issue Feb 4, 2023 · 0 comments
Open

d3.stop() should return the time it was stopped at #51

tansanDOTeth opened this issue Feb 4, 2023 · 0 comments

Comments

@tansanDOTeth
Copy link

tansanDOTeth commented Feb 4, 2023

I was looking into how I can gracefully resume a timer that might have been stopped and thought this would have been a natural choice, but noticed the function didn't return anything. This is helpful for pausing and resuming mid-way through an animation. If I restarted the timer, it will likely interrupt the timer and restart the animation.

const hello = (elapsedTime) => console.log("hello world", elapsedTime)
const timer = d3.timer(hello)

setTImeout(() => {
    const stoppedTime = timer.stop()
    setTImeout(() => {
        timer.restart(hello, null, stoppedTime)  
     }, 5000)
}, 5000)

Is there a way to achieve something similar?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant