Mercurial > touhou
comparison pytouhou/game/sprite.py @ 122:174324a4da51
Add support for launch animations! (Warning: slow :()
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sat, 10 Sep 2011 01:26:30 +0200 |
parents | 4300a832f033 |
children | 4f46717390aa |
comparison
equal
deleted
inserted
replaced
121:1bc0ad774ed4 | 122:174324a4da51 |
---|---|
59 self._rendering_data = None | 59 self._rendering_data = None |
60 | 60 |
61 | 61 |
62 def fade(self, duration, alpha, formula): | 62 def fade(self, duration, alpha, formula): |
63 if not self.fade_interpolator: | 63 if not self.fade_interpolator: |
64 self.fade_interpolator = Interpolator((self.alpha,), formula) | 64 self.fade_interpolator = Interpolator((self.alpha,), self.frame, |
65 self.fade_interpolator.set_interpolation_start(self.frame, (self.alpha,)) | 65 (alpha,), self.frame + duration, |
66 self.fade_interpolator.set_interpolation_end(self.frame + duration - 1, (alpha,)) | 66 formula) |
67 | 67 |
68 | 68 |
69 def scale_in(self, duration, sx, sy, formula): | 69 def scale_in(self, duration, sx, sy, formula): |
70 if not self.scale_interpolator: | 70 if not self.scale_interpolator: |
71 self.scale_interpolator = Interpolator(self.rescale, formula) | 71 self.scale_interpolator = Interpolator(self.rescale, self.frame, |
72 self.scale_interpolator.set_interpolation_start(self.frame, self.rescale) | 72 (sx, sy), self.frame + duration, |
73 self.scale_interpolator.set_interpolation_end(self.frame + duration - 1, (sx, sy)) | 73 formula) |
74 | 74 |
75 | 75 |
76 def move_in(self, duration, x, y, z, formula): | 76 def move_in(self, duration, x, y, z, formula): |
77 if not self.offset_interpolator: | 77 if not self.offset_interpolator: |
78 self.offset_interpolator = Interpolator(self.dest_offset, formula) | 78 self.offset_interpolator = Interpolator(self.dest_offset, self.frame, |
79 self.offset_interpolator.set_interpolation_start(self.frame, self.dest_offset) | 79 (x, y, z), self.frame + duration, |
80 self.offset_interpolator.set_interpolation_end(self.frame + duration - 1, (x, y, z)) | 80 formula) |
81 | 81 |
82 | 82 |
83 def update_orientation(self, angle_base=0., force_rotation=False): | 83 def update_orientation(self, angle_base=0., force_rotation=False): |
84 if (self.angle != angle_base or self.force_rotation != force_rotation): | 84 if (self.angle != angle_base or self.force_rotation != force_rotation): |
85 self.angle = angle_base | 85 self.angle = angle_base |