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

Aperta
#51 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
frontend

Direzione di ricerca

The issue shows a d3.timer example and proposes using the value returned by timer.stop() as the elapsed time passed to timer.restart(). Start by reading the timer API implementation and its tests to see how stopping and restarting currently handle elapsed time. Done means the API behavior supports pausing and resuming an animation as described, with tests covering the returned value and restart behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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?

Lingua principale
JavaScript
Stelle
168
Fork
43
Merge medio
2h 14m
PR unite (30g)
2

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di d3/d3-timer

Tutte le issue di d3/d3-timer

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.