diff options
author | Dan Williams <dcbw@redhat.com> | 2007-03-13 12:19:50 (GMT) |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2007-03-13 12:19:50 (GMT) |
commit | c58bb3549f195155e868aa46ddab8a39f60e82e1 (patch) | |
tree | 9a690c14625197931c02a79e02f8c07b455b77d4 | |
parent | ac8805246d61f105baff6340d06ccf55fa20a357 (diff) |
Ensure animations reach last frame
-rw-r--r-- | sugar/graphics/animator.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sugar/graphics/animator.py b/sugar/graphics/animator.py index 2021f42..60ff9f3 100644 --- a/sugar/graphics/animator.py +++ b/sugar/graphics/animator.py @@ -75,10 +75,14 @@ class Animation(object): start = self.start change = self.end - self.start - if easing == EASE_OUT_EXPO: - frame = change * (-pow(2, -10 * time/duration) + 1) + start; - elif easing == EASE_IN_EXPO: - frame = change * pow(2, 10 * (time / duration - 1)) + start; + if time == duration: + # last frame + frame = self.end + else: + if easing == EASE_OUT_EXPO: + frame = change * (-pow(2, -10 * time/duration) + 1) + start; + elif easing == EASE_IN_EXPO: + frame = change * pow(2, 10 * (time / duration - 1)) + start; self.next_frame(frame) |