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, or use Motions to collect ordinary transitions by key. Declare destinations 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§

AnchorElement
Frame-scoped measuring wrapper created by MotionAnchor::element.
AnimationState
Retained prepared-clip playback using Kit’s controllable executor clock. Controls are inherited from core::AnimationState; use now(cx) for them.
AutoSize
Measures content as a separate layout root, reserves its animated size, and clips painting/input to that reservation. This adds a layout node. Constraints are explicit because the content is measured before parent layout is resolved. This is real layout sizing, not GPU projection. Retain the same Kit-scoped ID.
Frame
A sampled frame with Kit-native element builders and portable status getters.
GestureElement
Frame-scoped input/motion wrapper produced by GestureState::bind.
GestureState
Retain one handle per logical control. Clones share input/motion state. Mouse release outside the hitbox, lost button, Escape, blur and deactivation clear ownership. Pinch and supported native touch gestures are opt-in; raw multi-touch availability depends on the backend/platform.
GraphState
View-owned native clock for a portable motion-value graph. Keep this state alive and notify after source/control changes.
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.
MotionAnchor
Retained measurement of one native element in logical window coordinates. Mount each anchor once. Clones share storage. clear releases a stale measurement before reusing the owner in another window.
MotionState
View-owned motion state using GPUI Kit’s monotonic executor clock.
MotionTreeState
Native owner for a portable variant tree; shares the graph’s explicit clock contract.
Motions
Component-owned keyed transitions using the shared engine and Kit’s 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.
PopElement
Native wrapper constructed by PopLayout.
PopLayout
Retain in the view. A container records its origin; exiting items reserve no flow space but remain at their last measured parent-relative bounds. Use the same container and retain outgoing content with PresenceGroup until exit finishes. Ancestor clipping still applies. Independent containers must use separate handles; this is not cross-parent projection.
PopRequest
Per-frame layout data for a popped element. Native implementations should use PopLayout::item; this type only appears through the Element trait.
ReorderElement
Native spatial reorder item.
ReorderGroup
Retained logical order and measured spatial geometry. Mouse/keyboard input, cancellation and optional edge autoscroll share the portable engine. Automatic axis detection occurs on acquisition. Host owns model persistence and focus restoration after removal. Cross-list transfer and virtualization are separate application policies; keep this group’s mounted geometry in one scroll source.
Scramble
Deterministic visual substitutions. The logical accessibility text is unchanged.
ScrollFrame
Native scroll sample, also suitable for feeding a portable graph or typed track.
ScrollMotion
Binds native scroll progress to partial numeric targets. Defaults to instant mapping; choose a spring for smoothing. Layout extent changes trigger a follow-up frame, so the previous measurement cannot remain stale after resize. Preserve its Kit-scoped ID and configure styles before wrapping.
ScrollTracker
Tracks an element’s progress through another measured element, with configurable intersections, margins and optional spring smoothing. Retain anchors and this state; render their wrappers in the same window.
SharedElement
Native position/crossfade appearance constructed by SharedLayout::member.
SharedLayout
View-owned shared identity registry. Exactly one active destination per key is required. Render incoming/outgoing appearances in a common overlay; retain outgoing content until its normal presence exit completes. Native clipping still applies, sizes change immediately, and independent scrolling coordinate spaces are not reconciled. This is position/crossfade, not full layoutId. Clones share storage. Call remove when a logical shared identity is finished.
SharedOverlay
Window-root coordinator connecting anchors in separate containers. Render its floating appearances in an unclipped root layer. Anchor geometry is reconciled in window coordinates, including explicitly tracked scrolling. Sizes can follow measured destinations through real layout; no scale projection or transformed clipping is installed. One active appearance per key is required. The host retains exits and owns focus/input policy.
SharedOverlayElement
Frame-scoped, window-coordinate position/crossfade appearance.
StyleFrame
Presented style tracks with Kit-native conversion and engine status getters.
StyleMotionState
Retain one style sampler per logical element. Uses Kit’s executor clock.
SvgFrame
A portable SVG presentation with Kit-native transform conversion.
SvgMotionState
Retained SVG transform sampler using Kit’s monotonic executor clock.
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.
Timeline
Prepared tracks for separate Kit elements, using the shared timeline engine. Track insertion allocates; sampling reuses a Kit frame buffer. Retain the timeline, add tracks once, and use now(cx) for playback controls.
TypedState
Kit executor clock around a shared, independently sampled typed state.
TypedTimeline
Kit executor clock around a shared heterogeneous timeline.
UnsupportedStyle
A requested style track has no public renderer hook in Kit 0.7.3.
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§

Axis
Native scroll axis.
NumberEffect
Digit transitions. Rolling and sliding retain unchanged digits by place value.
SizeAxis
Which measured dimensions interpolate. Other dimensions follow content immediately.
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.

Functions§

color_to_rgba
Converts the engine’s sRGB color to Kit’s native RGBA value.
native_scroll_progress
Reads native scroll offsets and extents; unscrollable content returns zero. Handles Kit’s negative scroll offsets and positive maximum extents.