Skip to main content

Crate gpui_motion_kit

Crate gpui_motion_kit 

Source
Expand description

GPUI Kit bindings for the portable gpui-ce-motion animation engine.

This adapter uses Kit’s GPUI types. It does not enable the core crate’s CE feature, and it does not change either renderer. Retain one state per logical object, declare its destination during render, and notify after input changes.

use gpui_ce_motion::{Motion, Target};
use gpui_motion_kit::MotionState;
use gpui_kit::{AnyElement, App, Window, div, prelude::*};

fn panel(state: &mut MotionState, open: bool, window: &mut Window, cx: &App) -> AnyElement {
    let frame = state.frame(Motion::new(Target::default()).present(open), window, cx);

    frame.render(|frame| frame.apply(div().child("Details")))
}

Re-exports§

pub use gpui_ce_motion as core;

Structs§

Frame
A sampled frame with Kit-native element builders and portable status getters.
LayoutGroup
A view-owned coordinate scope for automatic position-only layout animation. Clone shares the ancestor scope; retain one group across renders and use that same group for nested animated elements. Independent groups should not nest. Element history is owned by Kit’s keyed element state and lasts while mounted.
LayoutPositionElement
Transparent native wrapper produced by LayoutGroup::position. Its child’s paint, hitboxes and accessibility bounds receive the same prepaint translation. No scale/rotation, size projection, or cross-parent shared IDs.
MotionState
View-owned motion state using GPUI Kit’s monotonic executor clock.
NumberElement
Styled count declaration. Number formatting reserves at most 256 minimum digits.
NumberMotionState
Retained count animation. Unchanged digits match by place value, from the right.
Scramble
Deterministic visual substitutions. The logical accessibility text is unchanged.
TextElement
Styled native text declaration created by TextMotionState::element. Layout takes destination sizes immediately; use reflow for position motion. This is display text, not an editable or selectable input implementation.
TextMotionState
View-owned native text motion. Clones share lifecycle and shape caches. Retain one state per logical label, with one mounted element per state. Fonts and full runs are shaped before splitting; native glyph atlas painting preserves kerning, contextual forms, bidi positions, and emoji.
TextTarget
Text-relative offsets, opacity, and horizontal reveal fraction. Builders panic on non-finite offsets or fractions outside zero through one.
TextUnitInfo
Metadata supplied once when preparing each unit’s custom entrance.
ValueState
A retained scalar presentation in caller-chosen units.
VectorElement
Fixed-size native vector drawing. This paints vector geometry, not an SVG sprite or a GPUI subtree; it does not install pointer semantics.
VectorState
Retain one vector state per drawing. Clones share morph/reveal storage. Path sampling allocates no memory; native tessellation/paint preparation does.

Enums§

NumberEffect
Digit transitions. Rolling and sliding retain unchanged digits by place value.
TextClip
Stationary clipping around each unit’s final layout reservation.
TextError
Native text failures, independent of the chosen GPUI backend.
TextMatch
Identity policy when the requested text changes.
TextPreset
Convenience effects. A subsequent enter or exit overrides that target.
TextUnit
Grouping for text motion. Native adapters merge boundaries inside shaped clusters.