mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
animations: Don't convert linear easing to a bezier
This conversion can lead to floating point errors and extra work when computing animations. Avoiding it allows animation-iteration-count-009.html to pass.
This commit is contained in:
parent
954b5177f0
commit
cf4510011f
2 changed files with 11 additions and 19 deletions
|
@ -6,7 +6,6 @@
|
|||
//! https://drafts.csswg.org/css-easing/#timing-functions
|
||||
|
||||
use crate::parser::ParserContext;
|
||||
use crate::values::CSSFloat;
|
||||
|
||||
/// A generic easing function.
|
||||
#[derive(
|
||||
|
@ -118,18 +117,3 @@ impl<Integer, Number> TimingFunction<Integer, Number> {
|
|||
TimingFunction::Keyword(TimingKeyword::Ease)
|
||||
}
|
||||
}
|
||||
|
||||
impl TimingKeyword {
|
||||
/// Returns the keyword as a quadruplet of Bezier point coordinates
|
||||
/// `(x1, y1, x2, y2)`.
|
||||
#[inline]
|
||||
pub fn to_bezier(self) -> (CSSFloat, CSSFloat, CSSFloat, CSSFloat) {
|
||||
match self {
|
||||
TimingKeyword::Linear => (0., 0., 1., 1.),
|
||||
TimingKeyword::Ease => (0.25, 0.1, 0.25, 1.),
|
||||
TimingKeyword::EaseIn => (0.42, 0., 1., 1.),
|
||||
TimingKeyword::EaseOut => (0., 0., 0.58, 1.),
|
||||
TimingKeyword::EaseInOut => (0.42, 0., 0.58, 1.),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue