Sample CSS animation property tracks
This commit is contained in:
1 parent
642b6b57b5
commit
8754da5804
3 files changed
+1243
-144
No files matched your search
+1217
-144
File diff suppressed because it is too large.
Load diff
@@ -495,6 +495,14 @@ impl BackgroundPositionAxis {
|
|||||||
pub fn resolve(self, leftover_space: f32) -> f32 {
|
pub fn resolve(self, leftover_space: f32) -> f32 {
|
||||||
self.length + self.percentage * leftover_space
|
self.length + self.percentage * leftover_space
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn interpolate(self, other: Self, position: f32) -> Self {
|
||||||
|
Self {
|
||||||
|
length: self.length + (other.length - self.length) * position,
|
||||||
|
percentage: self.percentage
|
||||||
|
+ (other.percentage - self.percentage) * position,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The two axes of CSS `background-position`.
|
/// The two axes of CSS `background-position`.
|
||||||
@@ -511,6 +519,13 @@ impl BackgroundPosition {
|
|||||||
pub const fn new(x: BackgroundPositionAxis, y: BackgroundPositionAxis) -> Self {
|
pub const fn new(x: BackgroundPositionAxis, y: BackgroundPositionAxis) -> Self {
|
||||||
Self { x, y }
|
Self { x, y }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn interpolate(self, other: Self, position: f32) -> Self {
|
||||||
|
Self {
|
||||||
|
x: self.x.interpolate(other.x, position),
|
||||||
|
y: self.y.interpolate(other.y, position),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fill rule for a CSS `clip-path: polygon(...)`.
|
/// Fill rule for a CSS `clip-path: polygon(...)`.
|
||||||
|
|||||||
@@ -354,6 +354,17 @@ pub(crate) fn apply_animation_declarations(style: &mut LayoutStyle, css: &str) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Apply one already-cascaded keyframe declaration through the ordinary
|
||||||
|
/// computed-style parser. The animation sampler deliberately reuses this
|
||||||
|
/// path instead of maintaining a second, subtly different value parser.
|
||||||
|
pub(crate) fn apply_animation_property_value(
|
||||||
|
style: &mut LayoutStyle,
|
||||||
|
name: &str,
|
||||||
|
value: &str,
|
||||||
|
) {
|
||||||
|
apply_value(style, name, value);
|
||||||
|
}
|
||||||
|
|
||||||
fn apply_color_scheme(
|
fn apply_color_scheme(
|
||||||
style: &mut LayoutStyle,
|
style: &mut LayoutStyle,
|
||||||
value: &str,
|
value: &str,
|
||||||
|
|||||||
Reference in new issue
Block a user