Docs / Ship
Runtimes
The .egg file
Export bakes a project into a compact binary: artboards, animations, state machines, view models, and the pictures, sounds and fonts it needs (or, with --referenced, a folder of assets your app hands over at run time). A bundle (.eggs) holds several artboards.
Web
The web runtime is WebAssembly plus a small helper, egg-player.js, that sizes the canvas, runs the frame loop and forwards pointer, wheel, keyboard and text input.
index.htmlweb runtime
import init, * as egg from "./egg_web.js";
import { mount } from "./egg-player.js";
await init();
const bytes = new Uint8Array(await (await fetch("hatch.egg")).arrayBuffer());
const view = mount(egg, document.querySelector("canvas"), bytes, {
machine: "hatch", // "" = the first; null = play the first animation
fit: "contain", // or "layout": the artboard takes the canvas size
});| Option | Does |
|---|---|
artboard | Which artboard of a bundle ("" = the first). |
renderer | "canvas" (default, Canvas2D) or "pixels" (software, exact). |
openUrls | Follow "open URL" events (default true). |
sound | Play audio events (default true). |
onEvent | A function called with every event the file reports. |
semantics | Mirror tappable shapes as accessible elements (default true). |
Native and engines
One runtime written in Rust, with a C API and bindings on top of it:
| Platform | Binding |
|---|---|
| iOS, macOS | Swift package |
| Android | Kotlin (AAR) |
| Flutter | Dart packages (runtime and a player widget) |
| Unity | C# package |
| Unreal | Plugin |
| C, C++ and anything with an FFI | egg.h and egg.hpp |
Driving it from code
Every runtime exposes the same calls: start a state machine, set its inputs (set_bool, set_number, fire), read and write view model properties (vm_set_number, vm_fire, …), read the current state and take the events the file reported.