1bye / gpui-motion
git clone https://github.com/1bye/gpui-motion.git
v0.4.0 · 1d ago
Declarative, interruptible motion for native Rust applications on stock GPUI CE
—
stars, 24h
+93
stars, 7 days · #579
+93
stars, 30 days · #2,510
93
★ total · +93% this week
2
forks · 0 open issues
Star history starts 2026-10-20; the chart appears after the second daily snapshot.
LanguageRust
LicenseApache-2.0
Created2026-10-17 (3d ago)
Last push1d ago
Watchers0
OwnerUser
Links
README excerpt
# gpui-ce-motion **Declarative animation for native Rust apps on GPUI CE.** Describe the next state. Keep the motion state in your view. The library handles transitions, springs, and interruptions using stock GPUI CE—no React or renderer fork. Crates.io · API examples · API reference · Demos · GPUI Kit setup · Changelog ## Install For **GPUI Kit**, use `gpui-motion-kit`. The installation below is for GPUI CE. [code] Requires **Rust 1.95+**. Native adapters use **registry `gpui-ce =0.2.2`**. Use the same CE source and version throughout your app so its element types match. | Feature | Use it for | | -------------- | ----------------------------------------------------------------------- | | Default (none) | Portable animation math, explicit clocks, no third-party dependencies | | `text` | Portable Unicode text lifecycle and prepared text sampling | | `gpui` | Native adapters, text, SVG parsing, input, and automatic frame scheduling | | `svg-path` | Portable SVG path-data parser, including arcs | | `demo` | Running this repository's examples; adds the platform backends | | `native-tests` | Development checks using CE's TestPlatform | ## Quick start This is a GPUI component for an existing app. Click the card to change its width. Changing a target during animation continues from the displayed position; springs preserve velocity too. [code] `Motion` is a declaration you can recreate every render. `MotionState` is its retained history. Keep one state per logical object; key list items by stable IDs. Native adapters request frames while active. Notify the view after input changes. See a complete runnable app or try the showcase: [code] ## API The examples below cover every public API family. Each example stands on its own. Native elements require the `gpui` feature and an existing GPUI view. Keep states, groups, clips, and timelines in your view between renders. Build new targets as the UI changes. Prepare keyframe clips and parsed/measured paths outside `render`; reuse them until their inputs change. The native helpers below receive that retained state as a function argument; the portable examples use an explicit clock. With portable sampling, `sample(..., now, reduced_motion)` takes elapsed time and the user's reduced-motion preference. In a GPUI view, `frame(..., window, cx)` handles the clock, frame requests, and that preference for you. - **Animation:** Targets, timing, enter and exit, multiple animations, keyed presence. - **Playback:** Clips, timelines and stagger, variants. - **Interaction:** Gestures, dragging, scroll and visibility, reordering. - **Layout:** Positions, popped exits, content sizing, shared visuals. - **Drawing:** Styles, text and numbers, SVG transforms, vector paths, motion values, colors. - **New shared tools:** Reactive values, nested sequences, typed timelines, completion, measured interaction, spatial reorder, cross-container movement, path preparation, rich text. - **Reference:** Lifecycle and accessibil