I think, as Jason said, that you can make such a step as accurate as you want in animation (for example, using animation), and separately handle the problem of receiving remote information. However, for a quick fix, you can use the trick I sometimes use: to have a trace / shadow effect, clearing the 2D context with reduced opacity.
Thus, a clear function becomes:
function clear() { cxt.globalAlpha=0.3; cxt.fillStyle='#FFFFFF'; cxt.fillRect(0, 0, WIDTH, HEIGHT); cxt.globalAlpha=1; }
then you should not clear the draw () function and call clear () on the paint path.
I updated your fiddle:
http://jsfiddle.net/gamealchemist/yc6Lb/86/
play with alpha to get the desired effect.
Rq: you can clear some parts of the screen (for example, grading) with full opacity and use less opacity only in the animated part of the canvas.
source share