mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Fix inaccurate input progress in the final animation frame.
This commit is contained in:
parent
f1feddf52c
commit
e27c86fc49
1 changed files with 9 additions and 1 deletions
|
@ -355,7 +355,15 @@ impl PropertyAnimation {
|
|||
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 {
|
||||
if out > 1.0 {
|
||||
// FIXME: Basically, during the animation sampling process, the input progress
|
||||
// should be in the range of [0, 1]. However, |time| is not accurate enough
|
||||
// here, which means |time| could be larger than 1.0 in the last animation
|
||||
// frame. (It should be equal to 1.0 exactly.) This makes the output of frames
|
||||
// timing function jumps to the next frame/level.
|
||||
// However, this solution is still not correct because |time| is possible
|
||||
// outside the range of [0, 1] after introducing Web Animations. We should fix
|
||||
// this problem when implementing web animations.
|
||||
out = 1.0;
|
||||
}
|
||||
out
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue