Skip to main content

CompoundAnimation

Trait CompoundAnimation 

Source
pub trait CompoundAnimation<T>:
    Animation<T>
    + AnimationLazyListenerMixin
    + AnimationLocalListenersMixin
    + AnimationLocalStatusListenersMixin
where T: Clone + PartialEq + 'static,
{ // Required methods fn first(self: Handle<Self>, app: &App) -> AnyAnimation<T>; fn next(self: Handle<Self>, app: &App) -> AnyAnimation<T>; fn last_status(self: Handle<Self>, app: &App) -> Option<AnimationStatus>; fn last_status_mut( self: Handle<Self>, app: &mut App, ) -> &mut Option<AnimationStatus>; fn last_value(self: Handle<Self>, app: &App) -> &Option<T>; fn last_value_mut(self: Handle<Self>, app: &mut App) -> &mut Option<T>; // Provided methods fn status(self: Handle<Self>, app: &App) -> AnimationStatus { ... } fn maybe_notify_status_listeners( self: Handle<Self>, app: &mut App, _status: AnimationStatus, ) { ... } fn maybe_notify_listeners(self: Handle<Self>, app: &mut App) { ... } }
Expand description

An interface for combining multiple Animations. Implementors need only implement Animation::value to control how the child animations are combined. Can be chained to combine more than 2 animations.

For example, to create an animation that is the sum of two others, implement this trait and define value as first.value + next.value.

By default, the status of a compound animation is the status of the next animation if next is moving, and the status of the first animation otherwise.

Dart’s CompoundAnimation<T> is an abstract class whose handlers call the subclass’s value override. The upward call is what makes it a trait here; it reaches the override through as_animation, the erased handle, whose vtable is built from the subclass’s Animation impl. The fields Dart declares on the abstract class belong to the implementing type and reach the trait through the app-mediated accessors.

Required Methods§

Source

fn first(self: Handle<Self>, app: &App) -> AnyAnimation<T>

The first sub-animation. Its status takes precedence if neither are animating.

Source

fn next(self: Handle<Self>, app: &App) -> AnyAnimation<T>

The second sub-animation.

Source

fn last_status(self: Handle<Self>, app: &App) -> Option<AnimationStatus>

Dart’s _lastStatus, owned by the implementing type.

Source

fn last_status_mut( self: Handle<Self>, app: &mut App, ) -> &mut Option<AnimationStatus>

Dart’s _lastStatus, mutably.

Source

fn last_value(self: Handle<Self>, app: &App) -> &Option<T>

Dart’s _lastValue, owned by the implementing type.

Source

fn last_value_mut(self: Handle<Self>, app: &mut App) -> &mut Option<T>

Dart’s _lastValue, mutably.

Provided Methods§

Source

fn status(self: Handle<Self>, app: &App) -> AnimationStatus

Gets the status of this animation based on the first and next status.

The default is that if the next animation is moving, use its status. Otherwise, default to first.

Source

fn maybe_notify_status_listeners( self: Handle<Self>, app: &mut App, _status: AnimationStatus, )

Dart’s _maybeNotifyStatusListeners.

Source

fn maybe_notify_listeners(self: Handle<Self>, app: &mut App)

Dart’s _maybeNotifyListeners.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§