pub struct VarKeyframe {
pub at: TimePoint,
pub to: f64,
pub duration: TimePoint,
pub easing: EasingType,
}Expand description
One tween: hold at the running value until at, then ease to to over
duration, then hold at to until the next keyframe fires (or
forever, for the last one). See super::track’s module doc, “Value
outside the keyframes”, for the exact before-first/after-last rule.
Fields§
§at: TimePointWhere this segment starts, on the scenario’s absolute timeline.
Resolved via TimePoint::resolve_absolute with scene_start
pinned to 0.0 — a variable has no enclosing scene of its own, so
the leading @ this grammar otherwise requires for an absolute
reading is accepted but never changes anything here: "4b" and
"@4b" resolve identically for a VarKeyframe.
to: f64The value this segment eases towards.
duration: TimePointHow long the ease from the running value to to takes.
Not resolved the way you’d expect from reading TimePoint’s own
contract. TimePoint’s "b" unit is defined as a position on the
beat grid — beat_offset + n * 60 / bpm, beat_offset included, by
design, because every other TimePoint field in this schema (at,
Scene::at, a shake impact’s at, …) names a point in time, where
picking up the grid’s anchor is exactly right. duration is the one
exception: it names a span — “3 beats long” — and a span must not
shift just because the grid happens to start somewhere other than
zero. Resolving "3b" through TimePoint::resolve_relative
unchanged would compute beat_offset + 3 * 60 / bpm, silently
stretching every tween by the scenario’s own beat_offset on top of
its declared length. super::track::VarTrack::compile resolves
this field against a copy of the scenario’s TimeCtx with
beat_offset zeroed instead, so "3b" always means exactly
3 * 60 / bpm seconds — see that function’s doc, and
super::track’s module doc, for the full reasoning and a test
(beat_offset_does_not_leak_into_duration) pinning it down.
Defaults to an instant snap (0 seconds) when omitted.
easing: EasingTypeDefaults to EasingType::Linear — the same default
EasingType’s own #[default] picks, deliberately not
schema::animation::Animation’s node-animation default
(EaseOut): a variable has no established “usual feel” the way an
entrance animation does, so an un-set easing should be the
arithmetically neutral choice.
Trait Implementations§
Source§impl Clone for VarKeyframe
impl Clone for VarKeyframe
Source§impl Debug for VarKeyframe
impl Debug for VarKeyframe
Source§impl<'de> Deserialize<'de> for VarKeyframe
impl<'de> Deserialize<'de> for VarKeyframe
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 VarKeyframe
impl JsonSchema for VarKeyframe
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 VarKeyframe
impl PartialEq for VarKeyframe
Source§impl Serialize for VarKeyframe
impl Serialize for VarKeyframe
impl StructuralPartialEq for VarKeyframe
Auto Trait Implementations§
impl Freeze for VarKeyframe
impl RefUnwindSafe for VarKeyframe
impl Send for VarKeyframe
impl Sync for VarKeyframe
impl Unpin for VarKeyframe
impl UnsafeUnpin for VarKeyframe
impl UnwindSafe for VarKeyframe
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