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 20bbd703..a5ff5bf9 100644 --- a/crates/processing_wasm/examples/index.html +++ b/crates/processing_wasm/examples/index.html @@ -4,56 +4,28 @@