From c58bb3549f195155e868aa46ddab8a39f60e82e1 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 13 Mar 2007 12:19:50 +0000 Subject: Ensure animations reach last frame --- (limited to 'sugar') 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) -- cgit v0.9.1