mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
Auto merge of #27032 - mrobinson:fractional-iteration, r=jdm
animations: Finish support for fractional iteration counts This change also improves support for creating animations with negative delays, as that is necessary to test support for fractional iteration lengths. Fixes: #14858 <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #14858 - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
6659e9004d
20 changed files with 174 additions and 120 deletions
|
@ -386,7 +386,7 @@ impl Animations {
|
|||
now: f64,
|
||||
pipeline_id: PipelineId,
|
||||
) {
|
||||
let num_iterations = match animation.iteration_state {
|
||||
let iteration_index = match animation.iteration_state {
|
||||
KeyframesIterationState::Finite(current, _) |
|
||||
KeyframesIterationState::Infinite(current) => current,
|
||||
};
|
||||
|
@ -402,10 +402,14 @@ impl Animations {
|
|||
TransitionOrAnimationEventType::AnimationStart => {
|
||||
(-animation.delay).max(0.).min(active_duration)
|
||||
},
|
||||
TransitionOrAnimationEventType::AnimationIteration |
|
||||
TransitionOrAnimationEventType::AnimationEnd => num_iterations * animation.duration,
|
||||
TransitionOrAnimationEventType::AnimationIteration => {
|
||||
iteration_index * animation.duration
|
||||
},
|
||||
TransitionOrAnimationEventType::AnimationEnd => {
|
||||
(iteration_index * animation.duration) + animation.current_iteration_duration()
|
||||
},
|
||||
TransitionOrAnimationEventType::AnimationCancel => {
|
||||
(num_iterations * animation.duration) + (now - animation.started_at).max(0.)
|
||||
(iteration_index * animation.duration) + (now - animation.started_at).max(0.)
|
||||
},
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue