Skip to content
项目

关于

使用 Exact、Rust 和 WebGPU 构建的 100 多个 GPU 动画

网站与应用开发

这些数字如何统计

实测星标增长

24小时
0
7天
+16
15天
+18
1个月
+32

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Demos on Exact

The Demos launcher and its 109 animations, rebuilt on Exact: the UI and state are written in Contract, the heavy per-frame work (Skia-style drawing, shaders, physics) runs in Rust on wgpu, and the few things that must be native UIKit live in Swift.

The original React Native (Expo) app lives in .legacy/ and still runs from there (cd .legacy && bun install && bun run ios): see .legacy/README.md. It is the source of truth the Exact port is measured against.

Layout

Path What lives there
app.contract, app.ts The app: routing, the launcher, the demo screen.
home/ Launcher screens: the springboard, the demo screen shell, the atlas.
demos/<slug>/<slug>.contract One demo's UI, state and gestures.
demos/index.contract Registers every demo by slug.
demos.contract The launcher's list (generated by tools/gen-demos.ts).
gpu/src/<slug>.rs A demo's GPU surface, when it draws per frame. gpu/shaders/ holds its WGSL.
modules/apple/ Native views: glass buttons, sheets, alerts, tab bars, haptics.
packages/ Helper crates the demos rely on: motion, gestures, pressto, draw2d, noise.
assets/ Icons, images, fonts, audio.
tools/ Generators, the Contract linter, the lint scripts.
.parity/ Dev-only measuring and parity tooling (the feedback server, the screen atlas, probes); outside the app's build.
.legacy/ The original React Native app (Expo), its own project.

A demo with a GPU surface is split in two on purpose: the Contract file owns layout and input, the Rust file owns the pixels. They meet by the surface's name.

Run

bun install
bun exact.mjs web --port 5341          # dev server with hot reload
bun exact.mjs mac --run --url http://localhost:5341
bun exact.mjs phone <udid> --run --url http://<your-lan-ip>:5341

bun exact.mjs help lists every verb. bun tools/gen-demos.ts rebuilds the launcher's list from the original React Native app's registry (.legacy/src/animations/registry.ts).

The Exact checkout is .exact/checkout, a gitignored symlink exact.mjs makes to the checkout it finds (EXACT=<path> retargets it; the seed path in exact.mjs names the commit this tree was last updated to). The web build's wasm-bindgen CLI must be the version the checkout pins (game/Cargo.toml, 0.2.130 now): bun <checkout>/scripts/exact.mjs setup installs it into ~/.cargo/bin, which replaces the one other checkouts use; to keep both, cargo install wasm-bindgen-cli --version 0.2.130 --locked --root ~/.exact/bindgen-0.2.130 and put ~/.exact/bindgen-0.2.130/bin first on PATH for the dev server. See UPGRADE-NOTES.md.

Lint

tools/lint.sh all runs the Contract linter (polish and performance rules, with a baseline of accepted debt), the Rust format and clippy gate, the TypeScript check of the Bun tooling and the generated-files check; CI runs the part that needs no Exact checkout. What each check does, how to add a rule and how the baseline works: LINT.md.

Adding a demo

  1. Add demos/<slug>/<slug>.contract with a component that takes env: DemoEnv.
  2. Register it in demos/index.contract and the launcher list.
  3. If it needs per-frame drawing, add gpu/src/<slug>.rs and expose its surface().

See .claude/skills/port-demo/SKILL.md for the full routine.

License

This project is licensed under a custom Software License Agreement. See LICENSE.md for details.

探索相关项目

加载中…