Mercurial > touhou
comparison pytouhou/utils/interpolator.py @ 57:694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Tue, 23 Aug 2011 19:27:24 +0200 |
parents | ab826bc29aa2 |
children | af7914413b89 |
comparison
equal
deleted
inserted
replaced
56:299de3a9b69f | 57:694f25881d0f |
---|---|
19 self.start_values = tuple(values) | 19 self.start_values = tuple(values) |
20 self.end_values = tuple(values) | 20 self.end_values = tuple(values) |
21 self.start_frame = 0 | 21 self.start_frame = 0 |
22 self.end_frame = 0 | 22 self.end_frame = 0 |
23 self._frame = 0 | 23 self._frame = 0 |
24 | |
25 | |
26 def __nonzero__(self): | |
27 return self._frame <= self.end_frame | |
24 | 28 |
25 | 29 |
26 def set_interpolation_start(self, frame, values): | 30 def set_interpolation_start(self, frame, values): |
27 self.start_values = tuple(values) | 31 self.start_values = tuple(values) |
28 self.start_frame = frame | 32 self.start_frame = frame |
45 self._frame = frame | 49 self._frame = frame |
46 if frame >= self.end_frame: | 50 if frame >= self.end_frame: |
47 self.values = tuple(self.end_values) | 51 self.values = tuple(self.end_values) |
48 self.start_values = tuple(self.end_values) | 52 self.start_values = tuple(self.end_values) |
49 self.start_frame = frame | 53 self.start_frame = frame |
50 return frame == self.end_frame | |
51 else: | 54 else: |
52 truc = float(frame - self.start_frame) / float(self.end_frame - self.start_frame) | 55 truc = float(frame - self.start_frame) / float(self.end_frame - self.start_frame) |
53 self.values = tuple(start_value + truc * (end_value - start_value) | 56 self.values = tuple(start_value + truc * (end_value - start_value) |
54 for (start_value, end_value) in zip(self.start_values, self.end_values)) | 57 for (start_value, end_value) in zip(self.start_values, self.end_values)) |
55 return True | |
56 | 58 |