comparison pytouhou/utils/interpolator.py @ 62:1f591adcea04

Fix animation determination (ins_98 stuff) and some interpolation functions
author Thibaut Girka <thib@sitedethib.com>
date Wed, 24 Aug 2011 21:16:14 +0200
parents af7914413b89
children 174324a4da51
comparison
equal deleted inserted replaced
61:0886994029e4 62:1f591adcea04
46 self.end_values = tuple(values) 46 self.end_values = tuple(values)
47 47
48 48
49 def update(self, frame): 49 def update(self, frame):
50 self._frame = frame 50 self._frame = frame
51 if frame >= self.end_frame - 1: 51 if frame >= self.end_frame - 1: #XXX: skip the last interpolation step
52 # This bug is replicated from the original game
52 self.values = tuple(self.end_values) 53 self.values = tuple(self.end_values)
53 self.start_values = tuple(self.end_values) 54 self.start_values = tuple(self.end_values)
54 self.start_frame = frame 55 self.start_frame = frame
55 else: 56 else:
56 coeff = self._formula(float(frame - self.start_frame) / float(self.end_frame - self.start_frame)) 57 coeff = self._formula(float(frame - self.start_frame) / float(self.end_frame - self.start_frame))