Interactive WASM Demos with egui

Interactive WASM Demos with egui

Table of Contents

This site embeds interactive Rust applications compiled to WebAssembly directly in static pages. Here’s how it works.

Setup

Each demo is a standalone Cargo crate compiled to WASM with Trunk:

A demo crate needs crate-type = ["cdylib"], plus eframe and egui as dependencies. The HTML entry point is a single <canvas> element that Trunk wires up automatically.

Embedding

Demos embed via a Zola shortcode that renders a lazy-loading iframe. The WASM bundle only loads when the user clicks Load Demo. Example of a simple calculator is shown below: