#[repr(C, u8)]pub enum AnimationTiming {
Ease,
Linear,
EaseIn,
EaseOut,
EaseInOut,
Spring,
SpringGentle,
SpringSnappy,
CubicBezier(AnimationTimingBezier),
}Expand description
Timing for StyleAnimation.
The CSS keywords, the engine’s spring presets, and a custom
cubic-bezier(...) point list — permille-encoded (see
AnimationTimingBezier) because this enum lives inside CssProperty,
which derives Eq + Hash + Ord, and raw f32 control points cannot. Converted via Self::to_interpolation at the engine
boundary; native animation functions receive the DECLARED timing on
ZombieAnimInfo together with raw linear progress, so a callback can
apply this math — or its own — via Self::evaluate.
Variants§
Ease
Linear
EaseIn
EaseOut
EaseInOut
Spring
The engine’s default spring (SMOOTH).
SpringGentle
SpringSnappy
CubicBezier(AnimationTimingBezier)
cubic-bezier(x1, y1, x2, y2), control points in permille.
8 bytes vs the unit variants — boxing is not an option: this is a
repr(C, u8) ABI enum whose layout the C bindings depend on.
Implementations§
Source§impl AnimationTiming
impl AnimationTiming
Sourcepub fn to_interpolation(self) -> AnimationInterpolationFunction
pub fn to_interpolation(self) -> AnimationInterpolationFunction
The runtime interpolation this timing stands for.
Sourcepub fn evaluate(self, t: f32) -> f32
pub fn evaluate(self, t: f32) -> f32
Eased progress for raw linear t — the one-call way for a native
animation function to honour the timing the CSS requested.
pub fn as_css_string(self) -> String
pub fn from_css_str(s: &str) -> Option<Self>
Trait Implementations§
Source§impl Clone for AnimationTiming
impl Clone for AnimationTiming
Source§fn clone(&self) -> AnimationTiming
fn clone(&self) -> AnimationTiming
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more