WARNING: VERY MUCH IN A BETA STATE
A local web application allowing quick switching between sketches. New p5 files are hot-reloaded automatically added to the left bar.
The motivation is to provide the best of both worlds between the "default" mode and the instance mode.
- Like in the web editor, you can write concise code and quickly experiment with new sketches.
- Like in instance mode, you get inline documentation (by TS typings) and the comfort of a full IDE.
- Clone.
npm install.- Run
npm run devto launch the app andnpm run update-filesto hot-reload files. - Add .ts files with P5 code in the folder named sketches. See sample files for reference.
Every file in the sketches folder must
- be a .ts file
- include a
drawfunction - Export it with a named export (no
default). Basically every P5 global function listed here should work, as long as you export them.
For one sketch:
draw()and other function exports are imported from your file in thesketchesfolder and added to the globalwindowobject.- If no
setupis present, a basic fallback is provided. - P5 is called, detects these functions (see rules), runs the sketch and inserts a
canvasinindex.html.
Adding several sketches in the mix:
- Running
updateFileList.tscreates afiles.jsonfile. The Vue app uses the file list to populate the left navigation bar. - Everytime you click on a sketch in the left bar, functions are imported again, overwriting previous
windowsproperties. Vue is only used for routing and state management, it's always the same component instance.
- No cross-platform testing
- No serious memory leak testing
- No performance test with heavy files (WebGL and such).
