Code following this online class:
Creative Codeing with JavaScript
The project implements a sketch-switcher (chooser.js). Each sketch does not call canvasSketch itself, but instead just exports
a name
, sketch
, and (optional) createPane
method.
The chooser then managers stopping any previous animation going on and removing the canvas that was used (since canvas-sketch by default will add another one to the body).
It may be possible that the sketch-manager from canvas-sketh could be used more intelligently, but this was a quick and easy way to deal with it.