Include p5.js in Observable notebook

Here is a template for Observable p5.js notebooks:

Also, Tom MacWright has created a helper function which you can import into a notebook to get started quickly, as well as a template with it already in-place:

These are instance mode sketches,and you need to prefix everything – get ready write sketch.foo sketch.bar sketch.baz sketch.etc

One thing I discovered while writing the first template is that the sketches work well, but you cannot currently include libraries like p5.dom and p5.sound in Observable notebooks. I have an open question about that.

Edit:: Including p5.dom in Observable is quite possible – there is a trick to it, shared by twcw and now included in my template notebook (linked above).

1 Like