def add_skin_for_skeleton(self, skeleton, color, z=-1, editable=False): if self.user_skin: skin = BitmapSkin(skeleton, self.user_skin, color[3]) else: skin = ColorSkin(skeleton, color) self.skin = skin self.add(skin, z=z) xs, ys = director.get_window_size() skin.position = xs / 2 - 6, ys / 2 - 11 self.generate_control_points()
def start_animation(self): self.clean_skins() self.animating = True self.clean_control_points() if self.user_skin: skin = BitmapSkin(self.skeleton, self.user_skin) else: skin = ColorSkin(self.skeleton, (255, 255, 255, 255)) self.add(skin) xs, ys = director.get_window_size() skin.position = xs / 2 - 6, ys / 2 - 11 self.animation.move_start() skin.do( Animate(self.animation) + CallFunc(lambda: self.remove(skin)) + CallFunc(self.stop_animation)) skin.do(UpdateTimeline(self.animation.get_duration()), target=self.animation)