A demo showcasing how to create and use bindings for p5js
This project is made up of
- A bun script that is used to generate bindings for p5js class methods
- Script is based on script created for glare
- An html page that shows how to use those bindings to make a basic animation
To generate the FFI bindings you will need bun installed. Once you have bun installed run
bun run ./scripts/generate_p5.ts
This example uses esgleam to bundle the main gleam module for use in a static site.
To install esbuild run the following command. You should only need to run it once.
gleam run -m esgleam/bundle
To bundle the app run the following command after making code changes.
gleam run -m esgleam/bundle
You can use any static site server to host the app but for development you can continue to use esgleam by running
gleam run -m esgleam/serve