def animate_color(self, *args): self.color.rgba = self.mood app =App.get_running_app() random_color =self.new_hue() if app.word not in app.mood_dict: app.mood_dict[app.word] = random_color anim = Animation(mood = app.mood_dict[app.word], duration = 1.5, t = 'in_out_cubic') anim.on_start = self.animate_opacity anim.start(self)
def on_midi(self, msg): self.ear.hear(msg) if not self.ear.heard_count() >= 1: return heard = self.ear.retrieve() print("Heard", heard) for neighbor in self.map.neighbors(self.pc_loc): if notes_match(heard, self.map.node_label(neighbor).container()): prev_loc = self.pc_loc self.pc_loc = neighbor anim = Animation( center=(self.pc_loc.x, self.pc_loc.y), duration=0.5, transition=AnimationTransition.in_out_quad ) anim.on_complete = self.resetNavigationWidgets if self.overlay: anim.on_start = partial(self.reveal_map_areas, self.pc_loc) print(self.map.wall_between_nodes(prev_loc, self.pc_loc)) anim.start(self.features.pcWidget)
def shift_camera(self, final_pos=None, final_scale=None): if self.in_motion: return if final_pos is None: final_pos = self.gameworld.camera.camera_pos if final_scale is None: final_scale = self.gameworld.camera.camera_scale def motion_start(_): self.in_motion = True def motion_complete(_): self.in_motion = False self.gameworld.terrain.tile_trigger() self.gameworld.buildings.tile_trigger() anim = Animation(camera_pos=final_pos, camera_scale=final_scale, duration=0.15, t='out_sine') anim.on_start = motion_start anim.on_complete = motion_complete anim.start(self.gameworld.camera)
def on_pre_enter(self): anim = Animation(progress=1000, duration=3) anim.on_start = self.__prepare anim.on_complete = self.__start anim.start(self)