pub struct SpringDesc {
pub mass: f64,
pub stiffness: f64,
pub damping_ratio: f64,
}Expand description
The animation vocabulary: the shell-fed frame clock (FrameTime)
plus the pure easing/interpolation/spring math a widget or app advances it
through, flat-re-exported from frust-core::anim. Time enters from the
shell during paint (PaintCtx::frame_time); nothing here reads a clock.
Physical parameters of a damped spring (a mass on a spring with a damper).
damping_ratio is the dimensionless ζ: < 1 under-damped (overshoots and
oscillates), == 1 critically damped (fastest non-overshooting settle),
> 1 over-damped (slow, no overshoot). M3’s standard spring presets (which
live in frust-theme, not here) are expressed in these terms.
Fields§
§mass: f64Mass of the moving body (> 0).
stiffness: f64Spring stiffness k (> 0); higher is snappier.
damping_ratio: f64Damping ratio ζ (> 0); see the type docs.
Trait Implementations§
Source§impl Clone for SpringDesc
impl Clone for SpringDesc
Source§fn clone(&self) -> SpringDesc
fn clone(&self) -> SpringDesc
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SpringDesc
Source§impl Debug for SpringDesc
impl Debug for SpringDesc
Source§impl From<MotionSpring> for SpringDesc
Converts a MotionSpring token into the generic physics type
AnimationController::fling/
Spring::new consume.
impl From<MotionSpring> for SpringDesc
Converts a MotionSpring token into the generic physics type
AnimationController::fling/
Spring::new consume.
Mass is always 1.0 — every preset (this crate’s and each design
system’s own) is defined purely in terms of damping ratio + stiffness, so
mass has no token-level source to convert from.
Source§fn from(spring: MotionSpring) -> SpringDesc
fn from(spring: MotionSpring) -> SpringDesc
Source§impl PartialEq for SpringDesc
impl PartialEq for SpringDesc
impl StructuralPartialEq for SpringDesc
Auto Trait Implementations§
impl Freeze for SpringDesc
impl RefUnwindSafe for SpringDesc
impl Send for SpringDesc
impl Sync for SpringDesc
impl Unpin for SpringDesc
impl UnsafeUnpin for SpringDesc
impl UnwindSafe for SpringDesc
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.