From 682866a7506a783e44b99908ca729841f388d5cc Mon Sep 17 00:00:00 2001 From: Nitish C <86357181+Nitish-bot@users.noreply.github.com> Date: Tue, 17 Nov 2026 02:45:58 +0530 Subject: [PATCH 1/3] fix wasm example --- crates/processing_wasm/examples/index.html | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/processing_wasm/examples/index.html b/crates/processing_wasm/examples/index.html index 20bbd703..62aed17b 100644 --- a/crates/processing_wasm/examples/index.html +++ b/crates/processing_wasm/examples/index.html @@ -25,22 +25,23 @@ async function main() { await init(); await p.init(); - const surface = p.createSurface('canvas', 600, 600); + const surface = p.surfaceCreateFromCanvas('canvas', 600, 600); + const graphics = p.graphicsCreate(surface, 600, 600); - const bgImage = await p.loadImage('images/logo.png'); + const bgImage = await p.imageLoad('images/logo.png'); let frame = 0; function draw() { try { - p.beginDraw(surface); - p.backgroundImage(surface, bgImage); + p.beginDraw(graphics); + p.backgroundImage(graphics, bgImage); const x = 250 + Math.sin(frame * 0.02) * 200; - p.fill(surface, 0.9, 0.1, 0.3, 1.0); - p.rect(surface, x, 50, 100, 100, 20, 20, 20, 20); + p.setFill(graphics, 0.9, 0.1, 0.3, 1.0, 0 /* sRGB */); + p.rect(graphics, x, 50, 100, 100, 20, 20, 20, 20); - p.endDraw(surface); + p.endDraw(graphics); frame++; } catch (e) { From adfeffdb37dc16b9130e3528b9acb7b28531c184 Mon Sep 17 00:00:00 2001 From: Nitish C <86357181+Nitish-bot@users.noreply.github.com> Date: Tue, 17 Nov 2026 02:49:32 +0530 Subject: [PATCH 2/3] delete comment --- crates/processing_wasm/examples/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/processing_wasm/examples/index.html b/crates/processing_wasm/examples/index.html index 62aed17b..1a879e66 100644 --- a/crates/processing_wasm/examples/index.html +++ b/crates/processing_wasm/examples/index.html @@ -38,7 +38,7 @@ p.backgroundImage(graphics, bgImage); const x = 250 + Math.sin(frame * 0.02) * 200; - p.setFill(graphics, 0.9, 0.1, 0.3, 1.0, 0 /* sRGB */); + p.setFill(graphics, 0.9, 0.1, 0.3, 1.0, 0); p.rect(graphics, x, 50, 100, 100, 20, 20, 20, 20); p.endDraw(graphics); From 539243fdaeb9a3b19b8f70267f3be0c6fa13bcb0 Mon Sep 17 00:00:00 2001 From: Nitish C <86357181+Nitish-bot@users.noreply.github.com> Date: Tue, 17 Nov 2026 15:33:25 +0530 Subject: [PATCH 3/3] add examples --- .../examples/background_image.js | 18 ++++ crates/processing_wasm/examples/index.html | 65 ++++--------- crates/processing_wasm/examples/mouse_2d.js | 18 ++++ crates/processing_wasm/examples/processing.js | 97 +++++++++++++++++++ crates/processing_wasm/examples/translate.js | 34 +++++++ 5 files changed, 185 insertions(+), 47 deletions(-) create mode 100644 crates/processing_wasm/examples/background_image.js create mode 100644 crates/processing_wasm/examples/mouse_2d.js create mode 100644 crates/processing_wasm/examples/processing.js create mode 100644 crates/processing_wasm/examples/translate.js diff --git a/crates/processing_wasm/examples/background_image.js b/crates/processing_wasm/examples/background_image.js new file mode 100644 index 00000000..dc233f21 --- /dev/null +++ b/crates/processing_wasm/examples/background_image.js @@ -0,0 +1,18 @@ +// Background Image. +// +// Loads an image, draws it as the background and animates a rounded +// rectangle over it. +let logo; + +async function setup() { + size(600, 600); + logo = await loadImage('images/logo.png'); +} + +function draw() { + background(logo); + + const x = 250 + Math.sin(frameCount * 0.02) * 200; + fill(0.9, 0.1, 0.3); + rect(x, 50, 100, 100, 20); +} diff --git a/crates/processing_wasm/examples/index.html b/crates/processing_wasm/examples/index.html index 1a879e66..a5ff5bf9 100644 --- a/crates/processing_wasm/examples/index.html +++ b/crates/processing_wasm/examples/index.html @@ -4,57 +4,28 @@