pub struct AnimationTiming {
pub delay: f64,
pub duration: f64,
pub repeat: bool,
pub repeat_count: Option<u32>,
pub yoyo: bool,
pub repeat_delay: f64,
pub overshoot: Option<f64>,
pub spring: Option<SpringConfig>,
pub amplitude: Option<f64>,
}Expand description
Timing configuration for preset animations.
Fields§
§delay: f64Delay before animation starts (seconds).
duration: f64Animation duration (seconds).
repeat: boolLoop the animation continuously. Kept as a plain bool for source
compatibility with every reader that only ever checked this flag
(several live outside this workstream’s owned files) — true
covers both “loop forever” (repeat_count: None) and “loop a known
number of times” (repeat_count: Some(n)), so a finite count is
never mistaken for a one-shot animation by code that only reads
this field. The JSON "loop" key this deserializes from accepts
either shape (see [AnimationTimingWire]); repeat alone can’t
tell you which one was written — check repeat_count for that.
repeat_count: Option<u32>How many times the animation plays, when the JSON "loop" value
was a positive integer rather than a bare bool (issue #330) — e.g.
"loop": 12 for GSAP’s repeat: 11 (11 replays, 12 plays
total — this field counts total plays, not replays). None
defers entirely to repeat: true loops forever, false plays
once — today’s behaviour, unchanged. 0 and 1 both fold back
into repeat: false, repeat_count: None at parse time (see
[RepeatSpec::into_parts]): there is no visible difference
between “play once” and “loop zero times”, so there’s no reason to
carry a count that never changes anything downstream.
yoyo: boolReverse direction on every other play (ping-pong) instead of
snapping back to the start each cycle — GSAP calls this yoyo.
Only meaningful when the animation actually repeats (repeat or
repeat_count); a no-op otherwise. Works on any animation this
timing drives, not a fixed set of presets — see
engine::animator::cycle_time.
repeat_delay: f64Pause between plays, in seconds, held at the resting value of the
play that just finished before the next one starts. 0.0 (default)
is a seamless loop.
overshoot: Option<f64>Overshoot/anticipation intensity for scale_in/scale_out (0.0 = none, default 0.08 = 8%).
spring: Option<SpringConfig>Spring physics for the preset’s motion keyframes (translate/scale/
rotate — opacity keeps its ease to avoid alpha overshoot flashes).
bounce_in / elastic_in use their built-in springs as defaults;
this overrides them.
amplitude: Option<f64>Travel of an oscillating preset, in pixels (float_3d only; default
12). Threaded through to_preset_config into PresetConfig::amplitude,
which expand_preset_inner already reads — this field is what makes
an author-supplied amplitude actually reach it instead of the
hardcoded default on every element.
Implementations§
Source§impl AnimationTiming
impl AnimationTiming
pub fn to_preset_config(&self) -> PresetConfig
Trait Implementations§
Source§impl Clone for AnimationTiming
impl Clone for AnimationTiming
Source§impl Debug for AnimationTiming
impl Debug for AnimationTiming
Source§impl Default for AnimationTiming
impl Default for AnimationTiming
Source§impl<'de> Deserialize<'de> for AnimationTiming
impl<'de> Deserialize<'de> for AnimationTiming
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 AnimationTiming
impl JsonSchema for AnimationTiming
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 AnimationTiming
impl PartialEq for AnimationTiming
Source§impl Serialize for AnimationTiming
impl Serialize for AnimationTiming
impl StructuralPartialEq for AnimationTiming
Auto Trait Implementations§
impl Freeze for AnimationTiming
impl RefUnwindSafe for AnimationTiming
impl Send for AnimationTiming
impl Sync for AnimationTiming
impl Unpin for AnimationTiming
impl UnsafeUnpin for AnimationTiming
impl UnwindSafe for AnimationTiming
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