struct
Tween
pub struct Tween {
pub props: Vec<Prop>,
pub count: usize,
pub duration: f64,
pub delay: f64,
pub ease: Ease,
pub stagger: Option<Stagger>,
pub repeat: i32,
pub yoyo: bool,
pub repeat_delay: f64,
pub resolved: Vec<Vec<(String, String)>>,
}A tween over count targets.
Fields
resolved
pub resolved: Vec<Vec<(String, String)>>Per-target (from, to) values once resolved by a runtime.
Methods
new
pub fn new(count: usize) -> TweenA tween of count targets, with no properties yet, lasting half a second.
to
pub fn to(self, name: &str, value: impl ToString) -> TweenAnimate property name from where it is to value.
from
pub fn from(self, name: &str, value: impl ToString) -> TweenAnimate property name from value to where it is.
from_to
pub fn from_to(self, name: &str, from: impl ToString, to: impl ToString) -> TweenAnimate property name from from to to.
repeat
pub fn repeat(self, n: i32, yoyo: bool) -> TweenPlay it n more times (-1 forever), going back and forth when yoyo.
target_duration
pub fn target_duration(&self) -> f64One cycle plus repeats, for a single target (infinite if repeating forever).
progress
pub fn progress(&self, i: usize, t: f64) -> Option<f64>Eased progress (0..=1) for target i at local time t, or None before it starts.
resolve
pub fn resolve(&mut self, current: impl Fn(usize, &str) -> String)Fill in per-target start/end values, given each target's current value of a prop (current(target, prop)).