← Winnitude! Search  ·  Reader Mode (1506 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 45 LINKS

fix wasm example by Nitish-bot · Pull Request #278 · processing/libprocessing

Repository navigation

fix wasm example - #278


Open
Nitish-bot wants to merge 9 commits into processing:main from Nitish-bot:fix/wasm-example
Open

fix wasm example #278 Nitish-bot wants to merge 9 commits into processing:main from Nitish-bot:fix/wasm-example

Conversation

Nitish-bot commented Nov 16, 2026 · edited Loading



Copy link Copy Markdown
Contributor

The example had outdated function names and a lack of graphics entity

Nitish-bot added 2 commits November 17, 2026 02:45 fix wasm example 682866a delete comment adfeffd

Nitish-bot commented Nov 16, 2026



Copy link Copy Markdown
Contributor

Author

While I have 'fixed' the example, I assume setFill is an internal setter function and we hope to provide the same api as other processing tools with global functions and the user not having to own the graphics entity. Let me attempt to do that.

github-actions
Bot
commented Nov 16, 2026 · edited Loading



Copy link Copy Markdown

Visual regression: 1 changed of 43 cases

case status detail
py_flocking_gpu ❌ changed 8.19% of pixels differ

If these changes are intentional, add the deliberate-rendering-change label.

baseline fef469a14c · adapter llvmpipe (LLVM 20.1.2, 256 bits) (Vulkan, Mesa 25.2.8-0ubuntu0.24.04.5 (LLVM 20.1.2))

Open the visual report · workflow run

Nitish-bot added 5 commits November 17, 2026 15:33 add examples 539243f add tick, step and looping 1f167f5 tighten the api layer 2d6937e cleanup comments f21e277 fix: throw error from draw dcd62f8

Nitish-bot commented Nov 18, 2026



Copy link Copy Markdown
Contributor

Author

This started as a quick fix for the broken wasm example but grew quite a bit. There's now a whole Processing-style api layer (processing.js) that the examples run on. I am not sure if we plan to release a public JS API at all since p5 already exists but if we do then I'm hoping this layer can become the actual JS API people use.

There are a few things I know still need work before it's ready for that:

  • The sketch starts the moment the file is imported which is handy for the examples, but a real API should let people decide when to start.
  • The layer creates a surface and graphics when the sketch starts but never frees them, and the loop and mouse listeners are never stopped.
  • It just grabs the first <canvas> on the page. People should be able to pass in their own canvas, and we'd create one if they don't.
  • Everything is put on the global scope and it expects setup()/draw() to be globals too. That means you can't have two sketches on one page and it can clash with other libraries. p5's global vs instance mode is probably a good model here.

How do the maintainers see this going forward? Is a JS API like this something we're looking towards?

move the js layer out, keep the raw example and style bindings b07d6fe catilac requested review from catilac and tychedelia November 25, 2026 14:21 Merge branch 'main' into fix/wasm-example 9567769

This branch has not been deployed


No deployments
Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

None yet

2 participants