A Rust UI framework that draws every frame itself, at 120 Hz.

Rune brings its own GPU renderer, text, layout and springs. Views are plain Rust, a small app's first window opens in about 300 ms, and the same code runs on macOS, Windows, Linux, iOS and the web.

Lights

Spring

Snappy

Smooth

Bouncy

Drawn by Rune, live. Flip the switch, pick a spring, throw the puck.

A view is a plain Rust function of your state.

There is no markup and no macro language. view reads the state and returns elements; a handler changes the state and Rune draws what follows. Give an element .motion() and it moves to its new layout on a spring.

fn view(s: &State, _: &mut Cx<State>) -> El { let t = tok::theme(true); let label = text(if s.on { "Lights on" } else { "Lights off" }) .font(type_::TITLE).color(t.text); let knob = el().key("knob").size(18.0, 18.0).radius(9.0).fill(t.knob) .absolute(if s.on { 18.0 } else { 2.0 }, 2.0); // Screen readers hear "Lights, switch, on": the label names it, `checked` says its state. let switch = el().key("switch").role("switch").label("Lights").checked(s.on).focusable(true).size(38.0, 22.0).radius(11.0) .fill(if s.on { tok::accent(0, true) } else { t.control_off }) .motion(motion::SNAPPY) .on_press(|s: &mut State| s.on = !s.on) .child(knob); col().w_full().h_full().center().gap(16.0).fill(t.bg).child(label).child(switch) }

A dark window reading “Lights on” above a blue switch that is on

What it draws, rendered headless with --snap

Every animation is a spring that keeps its speed when you change your mind.

Springs take SwiftUI's numbers, a duration and a bounce, and are solved exactly, so a retarget starts from where the value is and how fast it's going. Nothing animates on the first frame, a finger moves things directly, and reduced motion swaps travel for a short fade.

Snappy

Smooth

Bouncy

Click the track, then click somewhere else before the puck lands. Or grab it and throw it. Turn off “Keep velocity” to see a spring that starts from rest every time.

#[test] fn animated_value_retargets_keeping_velocity() { let mut a = Animated::new(0.0f32); a.animate_to(100.0, motion::GLIDE, 0.0); let (x1, v1) = (a.sample(0.1), a.velocity(0.1)); a.animate_to(-50.0, motion::GLIDE, 0.1); assert!((a.sample(0.1) - x1).abs() < 1e-4); assert!((a.velocity(0.1) - v1).abs() < 1e-2); // … }

Every frame takes the same short path, from your input to one draw call.

Input changes your state. Rune calls your view, diffs it by key against the last one, lays it out with Taffy, moves what changed on springs and draws the whole window as one batch of instanced quads. At 120 Hz all of it has 8.33 ms, and an idle window draws nothing.

  • Input

    pointer, keys, text

  • State

    your struct, changed

  • View

    your view, called again

  • Diff

    keyed, against the last

  • Layout

    flex and grid, by Taffy

  • Springs

    position and velocity

  • Draw

    one instanced draw

Click the diagram to run the frame again.

Metal, glass and light are drawn by the same renderer.

They're GPU shaders, drawn live. These stills come straight out of Rune.

A ball of liquid chrome on black, reflecting a cool studio light

Liquid metal

A frosted glass tile over a blue disc, sharp beside the glass and soft through it

Frosted glass

Nine raised keys under one soft light, the middle one lit blue

Raised keys under one light

OpenCode's desktop app is the test Rune is built against.

Rune's first big job is rebuilding OpenCode's desktop app and raising its bar: long streaming sessions, markdown and code, window chrome and scroll momentum. These screens are drawn by Rune.

OpenCode drawn by Rune: a session with a sidebar of projects and a conversation with code
OpenCode drawn by Rune: the home screen with a prompt field
OpenCode drawn by Rune: a reply streaming in

An agent can build, run and check a Rune app without a screen.

Tests drive the real runtime: tap an element by key, step the clock, read where things are. Any app renders headless to a PNG with --snap, to a strip of frames with --frames, and prints its element tree with --tree.

#[test] fn a_tap_flips_the_switch_and_the_knob_springs_across() { let env = Env { system_dark: true, scale: 2.0 }; let mut rt = Runtime::new(State::default(), view, (320.0, 200.0), env); rt.frame(0.0); let knob_x = |rt: &Runtime<State>| rt.presented("knob").unwrap().0[0]; let off = knob_x(&rt); let (x, y) = rt.find("switch").unwrap(); rt.pointer_down(x, y); rt.pointer_up(x, y); for _ in 0..6 { rt.frame(1.0 / 60.0); } assert!(rt.state.on); let mid = knob_x(&rt); for _ in 0..60 { rt.frame(1.0 / 60.0); } let on = knob_x(&rt); assert!(off < mid && mid < on, "the knob travels: {off} → {mid} → {on}"); assert!((on - off - 16.0).abs() < 0.01, "and lands 16 points over"); }

  • A reference renderer.

    rune-ref draws the same scenes on the CPU, and golden tests hold the GPU within two levels per channel of it.

  • A motion audit.

    Example apps run scripted scenarios headless at 120 fps, and a checker flags snaps, pops, jumps and retargets that lose their speed.

  • Over 2,600 tests

    across the framework, its components and its motion.

The same code runs on macOS, Windows, Linux, iOS and the web.

  • macOS

    Rune's own Metal backend

  • Windows

    wgpu; windows stay hidden until their first frame

  • Linux

    wgpu on X11 and Wayland

  • iOS

    Embedded in UIKit or SwiftUI

  • Web

    WebGPU on one canvas, experimental

Pin a commit and start with one view.

Rune isn't on crates.io yet. Add it from Git at a commit, then start from examples/hello.

rune = { git = "https://github.com/anomalyco/rune", rev = "66006728af7c" }