/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Generic values for properties related to animations and transitions.
usecrate::derives::*; usecrate::typed_om::{KeywordValue, ToTyped, TypedValue}; usecrate::values::generics::length::GenericLengthPercentageOrAuto; usecrate::values::specified::animation::{
ScrollAxis, ScrollFunction, TimelineName, TimelineRangeName,
}; usecrate::values::specified::length::EqualsPercentage; usecrate::Zero; use std::fmt::{self, Write}; use style_traits::{CssString, CssWriter, ToCss}; use thin_vec::ThinVec;
/// The `animation-duration` property. /// /// https://drafts.csswg.org/css-animations-2/#animation-duration #[derive(
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem,
)] #[repr(C, u8)] pubenum GenericAnimationDuration<T> { /// The initial value. However, we serialize this as 0s if the preference is disabled.
Auto, /// The time value, <time [0s,∞]>.
Time(T),
}
pubuseself::GenericAnimationDuration as AnimationDuration;
/// Returns true if it is auto (i.e. the default value). pubfn is_auto(&self) -> bool {
matches!(self, Self::Auto)
}
}
/// A generic value for the `[ [ auto | <length-percentage> ]{1,2} ]`. /// /// https://drafts.csswg.org/scroll-animations-1/#view-timeline-inset #[derive(
Clone,
Copy,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToResolvedValue,
ToShmem,
)] #[repr(C)] pubstruct GenericViewTimelineInset<LengthPercent> { /// The start inset in the relevant axis. pub start: GenericLengthPercentageOrAuto<LengthPercent>, /// The end inset. pub end: GenericLengthPercentageOrAuto<LengthPercent>,
}
pubuseself::GenericViewTimelineInset as ViewTimelineInset;
impl<LengthPercent> ViewTimelineInset<LengthPercent> { /// Returns true if it is auto. #[inline] fn is_auto(&self) -> bool { self.start.is_auto() && self.end.is_auto()
}
}
/// A value for animation-range-start or animation-range-end. /// /// https://drafts.csswg.org/scroll-animations-1/#animation-range-start /// https://drafts.csswg.org/scroll-animations-1/#animation-range-end #[derive(
Clone,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToResolvedValue,
ToShmem,
)] #[repr(C)] pubstruct GenericAnimationRangeValue<LengthPercent> { /// The specific timeline range. If it is None, the animation range only has length-percentage /// component. pub name: TimelineRangeName, /// Used to measure the specific point from the start of the named timeline. pub lp: LengthPercent,
}
pubuseself::GenericAnimationRangeValue as AnimationRangeValue;
impl<LengthPercent> AnimationRangeValue<LengthPercent> { /// Returns the "normal" value #[inline] pubfn normal(lp: LengthPercent) -> Self { Self::new(TimelineRangeName::Normal, lp)
}
/// Returns Self as a LengthPercentage. #[inline] pubfn length_percentage(lp: LengthPercent) -> Self { Self::new(TimelineRangeName::None, lp)
}
/// Returns Self as a tuple of TimelineRangeName range name and LengthPercentage. #[inline] pubfn new(name: TimelineRangeName, lp: LengthPercent) -> Self { Self { name, lp }
}
/// Returns true if it is "normal". #[inline] pubfn is_normal(&self) -> bool { self.name.is_normal()
}
}
/// A value for animation-range-start. /// /// https://drafts.csswg.org/scroll-animations-1/#animation-range-start #[derive(
Clone,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToResolvedValue,
ToShmem,
ToTyped,
)] #[repr(transparent)] #[typed(todo_derive_fields)] pubstruct GenericAnimationRangeStart<LengthPercent>(pub GenericAnimationRangeValue<LengthPercent>);
pubuseself::GenericAnimationRangeStart as AnimationRangeStart;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.