mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Add frames into style system and update animation with frames functions.
This commit is contained in:
parent
18c72ac28d
commit
f1feddf52c
4 changed files with 57 additions and 5 deletions
|
@ -352,6 +352,14 @@ impl PropertyAnimation {
|
|||
TransitionTimingFunction::Steps(steps, StartEnd::End) => {
|
||||
(time * (steps as f64)).floor() / (steps as f64)
|
||||
}
|
||||
TransitionTimingFunction::Frames(frames) => {
|
||||
// https://drafts.csswg.org/css-timing/#frames-timing-functions
|
||||
let mut out = (time * (frames as f64)).floor() / ((frames - 1) as f64);
|
||||
if out > 1.0 && time <= 1.0 {
|
||||
out = 1.0;
|
||||
}
|
||||
out
|
||||
}
|
||||
};
|
||||
|
||||
self.property.update(style, progress);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue