Skip to main content

Animated

Trait Animated 

Source
pub trait Animated:
    Styled
    + IntoElement
    + Sized
    + 'static {
    // Provided methods
    fn animate_in(
        self,
        id: impl Into<ElementId>,
        cx: &App,
        entrance: Entrance,
    ) -> AnimationElement<Self> { ... }
    fn animate_in_staggered(
        self,
        id: impl Into<ElementId>,
        cx: &App,
        entrance: Entrance,
        index: usize,
        count: usize,
    ) -> AnimationElement<Self> { ... }
    fn animate_with(
        self,
        id: impl Into<ElementId>,
        entrance: Entrance,
        spec: MotionSpec,
    ) -> AnimationElement<Self> { ... }
    fn animate_change(
        self,
        id: impl Into<ElementId>,
        cx: &App,
    ) -> AnimationElement<Self> { ... }
    fn animate_sprung(
        self,
        id: impl Into<ElementId>,
        cx: &App,
        entrance: Entrance,
        preset: SpringPreset,
    ) -> AnimationElement<Self> { ... }
}
Expand description

A token-backed entrance in one call.

Provided Methods§

Source

fn animate_in( self, id: impl Into<ElementId>, cx: &App, entrance: Entrance, ) -> AnimationElement<Self>

Runs entrance on this element.

The travel is applied as a relative offset, so the element occupies its settled box for the whole run and nothing beside it moves. Under gpui::App::reduce_motion GPUI finishes the animation immediately, which lands the element exactly where it was going to be anyway.

Source

fn animate_in_staggered( self, id: impl Into<ElementId>, cx: &App, entrance: Entrance, index: usize, count: usize, ) -> AnimationElement<Self>

The same arrival, delayed into place as one member of a group.

The wave is capped however long the group is, so a five hundred row list finishes arriving in the same window an eight row one does.

Source

fn animate_with( self, id: impl Into<ElementId>, entrance: Entrance, spec: MotionSpec, ) -> AnimationElement<Self>

The arrival with a specification the caller has already composed — sequenced after another, delayed, or re-sprung.

Source

fn animate_change( self, id: impl Into<ElementId>, cx: &App, ) -> AnimationElement<Self>

The response an element gives when the value it is showing changes.

Short and opacity-only, because it is answering something the user has just done and the element is not going anywhere.

Source

fn animate_sprung( self, id: impl Into<ElementId>, cx: &App, entrance: Entrance, preset: SpringPreset, ) -> AnimationElement<Self>

The arrival on a named spring rather than along a curve.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Styled + IntoElement + Sized + 'static> Animated for T