pub struct SpringConfig {
pub damping: f64,
pub stiffness: f64,
pub mass: f64,
pub duration: Option<f64>,
pub rest_threshold: Option<f64>,
}Fields§
§damping: f64§stiffness: f64§mass: f64§duration: Option<f64>Force the spring to visually settle at exactly this many seconds
(issue #167 lot E), instead of leaving the settle time as an
emergent, hard-to-predict consequence of damping/stiffness/
mass. Implemented as a linear rescale of the time axis fed to the
physics solver (engine::animator::spring_value): the spring’s
shape — number of oscillations, overshoot amplitude — is a
function of damping/stiffness/mass alone and is unchanged;
only how fast that shape plays back changes. None (default)
leaves the natural, emergent settle time in place.
This does not resize the enclosing keyframe segment (the
delay/duration on the surrounding AnimationTiming, or the
author’s own keyframe times on a keyframes effect): those still
decide when the segment starts and how long it spans. Set that
enclosing span to at least duration (rustmotion info reports the
computed settle time so you don’t have to guess), or the segment’s
own end will still cut the spring’s motion short.
rest_threshold: Option<f64>How close to the target counts as “at rest”, as a fraction of the
total 0→1 travel (e.g. 0.01 = 1%). Defaults to
engine::animator::DEFAULT_SPRING_REST_THRESHOLD (0.5%) when unset.
Read by engine::animator::spring_rest_time — the “how long until
this spring settles” measurement rustmotion info surfaces — and,
when duration is set, by the remap above to know what “settled”
means. A critically- or over-damped spring approaches its target
asymptotically and never reaches it exactly, which is precisely why
this threshold exists.
Trait Implementations§
Source§impl Clone for SpringConfig
impl Clone for SpringConfig
Source§fn clone(&self) -> SpringConfig
fn clone(&self) -> SpringConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SpringConfig
impl Debug for SpringConfig
Source§impl Default for SpringConfig
impl Default for SpringConfig
Source§impl<'de> Deserialize<'de> for SpringConfig
impl<'de> Deserialize<'de> for SpringConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for SpringConfig
impl JsonSchema for SpringConfig
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§impl PartialEq for SpringConfig
impl PartialEq for SpringConfig
Source§impl Serialize for SpringConfig
impl Serialize for SpringConfig
impl StructuralPartialEq for SpringConfig
Auto Trait Implementations§
impl Freeze for SpringConfig
impl RefUnwindSafe for SpringConfig
impl Send for SpringConfig
impl Sync for SpringConfig
impl Unpin for SpringConfig
impl UnsafeUnpin for SpringConfig
impl UnwindSafe for SpringConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more