mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Make SVGPathData and clip-path: path() animatable.
Implement Animate trait for SVGPathData. The basic idea is: we normalize |this| and |other| svg paths, and then do interpolation on the normalized svg paths. The normalization is to convert relative coordinates into absolute coordinates, so we could do real number interpolation on each path command directly. In this patch, we also make |clip-path:path()| animatable. Differential Revision: https://phabricator.services.mozilla.com/D4786
This commit is contained in:
parent
9c1c58a498
commit
14911b96e0
4 changed files with 175 additions and 4 deletions
|
@ -141,6 +141,20 @@ impl Animate for f64 {
|
|||
}
|
||||
}
|
||||
|
||||
/// This is only used in SVG PATH. We return Err(()) if the flags are mismatched.
|
||||
// FIXME: Bug 653928: If we want to do interpolation on the flags in Arc, we have to update this
|
||||
// because `absolute`, `large_arc_flag`, and `sweep_flag` are using this implementation for now.
|
||||
impl Animate for bool {
|
||||
#[inline]
|
||||
fn animate(&self, other: &Self, _procedure: Procedure) -> Result<Self, ()> {
|
||||
if *self == *other {
|
||||
Ok(*other)
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Animate for Option<T>
|
||||
where
|
||||
T: Animate,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue