comparison pytouhou/game/sprite.py @ 280:e04c3e1957c8

Fix ANM interpolators.
author Thibaut Girka <thib@sitedethib.com>
date Wed, 08 Feb 2012 19:56:56 +0100
parents d3ba32a9096e
children f3099ebf4f61
comparison
equal deleted inserted replaced
279:3539520fff93 280:e04c3e1957c8
59 59
60 self._rendering_data = None 60 self._rendering_data = None
61 61
62 62
63 def fade(self, duration, alpha, formula): 63 def fade(self, duration, alpha, formula):
64 if not self.fade_interpolator: 64 self.fade_interpolator = Interpolator((self.alpha,), self.frame,
65 self.fade_interpolator = Interpolator((self.alpha,), self.frame, 65 (alpha,), self.frame + duration,
66 (alpha,), self.frame + duration, 66 formula)
67 formula)
68 67
69 68
70 def scale_in(self, duration, sx, sy, formula): 69 def scale_in(self, duration, sx, sy, formula):
71 if not self.scale_interpolator: 70 self.scale_interpolator = Interpolator(self.rescale, self.frame,
72 self.scale_interpolator = Interpolator(self.rescale, self.frame, 71 (sx, sy), self.frame + duration,
73 (sx, sy), self.frame + duration, 72 formula)
74 formula)
75 73
76 74
77 def move_in(self, duration, x, y, z, formula): 75 def move_in(self, duration, x, y, z, formula):
78 if not self.offset_interpolator: 76 self.offset_interpolator = Interpolator(self.dest_offset, self.frame,
79 self.offset_interpolator = Interpolator(self.dest_offset, self.frame, 77 (x, y, z), self.frame + duration,
80 (x, y, z), self.frame + duration, 78 formula)
81 formula)
82 79
83 80
84 def update_orientation(self, angle_base=0., force_rotation=False): 81 def update_orientation(self, angle_base=0., force_rotation=False):
85 if (self.angle != angle_base or self.force_rotation != force_rotation): 82 if (self.angle != angle_base or self.force_rotation != force_rotation):
86 self.angle = angle_base 83 self.angle = angle_base