Skip to main content

RectTweenObject

Trait RectTweenObject 

Source
pub trait RectTweenObject: 'static {
    // Required methods
    fn begin(&self, app: &App) -> Option<Rect>;
    fn end(&self, app: &App) -> Option<Rect>;
    fn lerp(&self, app: &App, t: f64) -> Option<Rect>;

    // Provided methods
    fn transform(&self, app: &App, t: f64) -> Option<Rect> { ... }
    fn evaluate(&self, app: &App, animation: AnyAnimation<f64>) -> Option<Rect> { ... }
}
Expand description

Dart’s Tween<Rect?>: the tween a CreateRectTween returns and a hero flight animates the hero’s bounds with.

Rust has no subtyping, so a flight holds this as Rc<dyn RectTweenObject>; waft-animation’s RectTween — Dart’s default — implements it, and so does any tween a caller supplies.

Required Methods§

Source

fn begin(&self, app: &App) -> Option<Rect>

The value this variable has at the beginning of the animation.

Source

fn end(&self, app: &App) -> Option<Rect>

The value this variable has at the end of the animation.

Source

fn lerp(&self, app: &App, t: f64) -> Option<Rect>

Returns the value this variable has at the given animation clock value.

Provided Methods§

Source

fn transform(&self, app: &App, t: f64) -> Option<Rect>

Returns the value this variable has at the given animation clock value, snapping to begin and end at the ends of the interval.

Source

fn evaluate(&self, app: &App, animation: AnyAnimation<f64>) -> Option<Rect>

The current value of this object for the given animation.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl RectTweenObject for Ref<RectTween>

Source§

fn begin(&self, app: &App) -> Option<Rect>

Source§

fn end(&self, app: &App) -> Option<Rect>

Source§

fn lerp(&self, app: &App, t: f64) -> Option<Rect>

Implementors§