pub struct MotionContext {
pub origin: Point,
pub target: Point,
pub distance_px: f32,
pub duration: Duration,
pub params: HashMap<String, f64>,
}Expand description
Movement metadata handed to motion-aware curve samplers.
Fields§
§origin: Point§target: Point§distance_px: f32Euclidean distance between origin and target, in pixels.
duration: DurationConcrete wall-clock duration the animation will run for.
params: HashMap<String, f64>Free-form parameter bag for the sampler function.
Implementations§
Source§impl MotionContext
impl MotionContext
Sourcepub fn new(origin: Point, target: Point, duration: Duration) -> Self
pub fn new(origin: Point, target: Point, duration: Duration) -> Self
Construct with distance_px computed automatically.
pub fn with_params(self, params: HashMap<String, f64>) -> Self
pub fn with_param(self, key: impl Into<String>, value: f64) -> Self
pub fn param(&self, key: &str) -> Option<f64>
Trait Implementations§
Source§impl Clone for MotionContext
impl Clone for MotionContext
Auto Trait Implementations§
impl Freeze for MotionContext
impl RefUnwindSafe for MotionContext
impl Send for MotionContext
impl Sync for MotionContext
impl Unpin for MotionContext
impl UnsafeUnpin for MotionContext
impl UnwindSafe for MotionContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more