aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/animations.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/animations.rs')
-rw-r--r--components/script/animations.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/components/script/animations.rs b/components/script/animations.rs
index bddbac14966..854a06a1e12 100644
--- a/components/script/animations.rs
+++ b/components/script/animations.rs
@@ -365,7 +365,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,
};
@@ -381,10 +381,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!(),
}