gpui_transitions

Crates.iogpui_transitions
lib.rsgpui_transitions
version0.1.5
created_at2025-12-25 16:33:54.916695+00
updated_at2026-01-19 13:57:08.902609+00
descriptionprovides an API for interpolating between values in GPUI.
homepagehttps://github.com/astrum-chat/gpui_transitions
repository
max_upload_size
id2004719
size236,110
Cameron Campbell (cameronpcampbell)

documentation

README

gpui_transitions.

This crate provides an API for interpolating between values in gpui.

Transitions can be constructed via window.use_transition or window.use_keyed_transition. It's very similar to the use_state API.

let my_transition = window
    .use_keyed_transition(
        "my_transition",
        cx,
        Duration::from_millis(400),
        |_window, _cx| rgb(0xFF0000)),
    );

They can also be constructed more granularly via Transition::new:

let my_transition = Transition::new(
    cx.new(|_cx| TransitionState::new(rgb(0xFF0000))),
    Duration::from_millis(400),
);

To get the value of a transition you can use evaluate. This is the equivilant of use_state's read method.

let value = my_transition.evaluate(window, cx);

If the transition is not finished when evaluate is called then an animation frame will be requested.


Updating the transition's goal is identical to updating state:

my_transition.update(cx, |this, cx| {
    *this = rgb(0x00FF00);
    cx.notify();
});

Examples can be found here.

Commit count: 0

cargo fmt