Ticker - Fluxdown
Smoothing answers two questions: when to update, and how much to reveal. The ticker handles the first; the scheduler handles the second.
In a browser, the default ticker follows animation frames. Keep that default unless you want fewer updates or need to use a clock supplied by your host environment.
Slow down the ticks
Both sides receive the same text and use the same spring scheduler. Try 320 ms on the right: text arrives in visible steps. At 50 ms, those steps become smaller.
The Received bar advances as each batch arrives. Between batches, the text below can keep unfolding. Click the output area to bring the next batch forward.
The same text and spring scheduler on both sides.
Fewer ticks can mean more progress per tick. A ticker does not directly set the reading speed: the spring scheduler calculates progress from elapsed time and the waiting content.
Use a built-in ticker
'raf' follows requestAnimationFrame, which suits continuous browser rendering. 'interval' uses a timer, ticking about every 16.7 milliseconds by default. With smooth: true, Fluxdown chooses an available ticker automatically.
Here is the React configuration. Other frameworks accept the same options through streaming.smooth:
Entry effects are disabled here so the update interval is easier to see. You can still combine smoothing with animation effects.
Choose an interval
You do not need to write a timer just to change its frequency. Extend IntervalSmoothTicker and pass an interval to its constructor. This is the 160 ms option in the demo:
Pass the class, not new SlowTicker(). Fluxdown creates the instance, stops it when the content has caught up and the scheduler permits it, restarts it for new content, and cleans it up when the component is destroyed. Keep the class outside your component so each render does not replace it.
Connect another clock
If your host provides its own frame callbacks, extend BaseSmoothTicker and supply these members:
In each callback, emit its timestamp with this.subject.next(timestamp). The return values of start() and now() and the emitted timestamps must share one clock origin. Do not mix wall-clock time with time measured since the page started. The base class's destroy() stops a running ticker and completes its observable.
To change how fast the text catches up, or reveal a fixed number of units at a time, continue to Scheduler.