add clear/fc/fail animation

This commit is contained in:
Anthony Samms
2025-10-12 02:51:43 -04:00
parent 92b089b07c
commit 0999a2034b
6 changed files with 195 additions and 22 deletions

View File

@@ -223,17 +223,21 @@ class TextureChangeAnimation(BaseAnimation):
self.is_finished = True
class TextStretchAnimation(BaseAnimation):
def __init__(self, duration: float, loop: bool = False, lock_input: bool = False) -> None:
super().__init__(duration, loop=loop, lock_input=lock_input)
def __init__(self, duration: float, loop: bool = False, lock_input: bool = False, delay: float = 0.0) -> None:
super().__init__(duration, loop=loop, lock_input=lock_input, delay=delay)
def update(self, current_time_ms: float) -> None:
if not self.is_started:
return
super().update(current_time_ms)
elapsed_time = current_time_ms - self.start_ms
if elapsed_time <= self.duration:
self.attribute = 2 + 5 * (elapsed_time // 25)
elif elapsed_time <= self.duration + 116:
frame_time = (elapsed_time - self.duration) // 16.57
if elapsed_time < self.delay:
return
animation_time = elapsed_time - self.delay
if animation_time <= self.duration:
self.attribute = 2 + 5 * (animation_time // 25)
elif animation_time <= self.duration + 116:
frame_time = (animation_time - self.duration) // 16.57
self.attribute = 2 + 10 - (2 * (frame_time + 1))
else:
self.attribute = 0
@@ -346,13 +350,14 @@ class Animation:
return TextureChangeAnimation(duration, **kwargs)
@staticmethod
def create_text_stretch(duration: float) -> TextStretchAnimation:
def create_text_stretch(duration: float, **kwargs) -> TextStretchAnimation:
"""Create a text stretch animation.
Args:
duration: Length of the stretch in milliseconds
delay: Time to wait before starting the stretch
"""
return TextStretchAnimation(duration)
return TextStretchAnimation(duration, **kwargs)
@staticmethod
def create_texture_resize(duration: float, **kwargs) -> TextureResizeAnimation:

View File

@@ -8,7 +8,6 @@ class Nameplate:
def __init__(self, name: str, title: str, player_num: int, dan: int, is_gold: bool):
self.name = OutlinedText(name, 22, ray.WHITE, ray.BLACK, outline_thickness=3.0)
self.title = OutlinedText(title, 20, ray.BLACK, ray.WHITE, outline_thickness=0)
print(self.name.texture.width)
self.dan_index = dan
self.player_num = player_num
self.is_gold = is_gold

View File

@@ -99,7 +99,6 @@ class TextureWrapper:
def load_zip(self, screen_name: str, subset: str):
zip = (self.graphics_path / screen_name / subset).with_suffix('.zip')
if screen_name in self.textures and subset in self.textures[screen_name]:
print(screen_name, subset)
return
with zipfile.ZipFile(zip, 'r') as zip_ref:
if 'texture.json' not in zip_ref.namelist():

View File

@@ -698,8 +698,6 @@ class TJAParser:
bisect.insort(curr_draw_list, note, key=lambda x: x.load_ms)
self.get_moji(curr_note_list, ms_per_measure)
index += 1
if hasattr(curr_bar_list[-1], 'branch_params'):
print(curr_note_list[-1])
# https://stackoverflow.com/questions/72899/how-to-sort-a-list-of-dictionaries-by-a-value-of-the-dictionary-in-python
# Sorting by load_ms is necessary for drawing, as some notes appear on the
# screen slower regardless of when they reach the judge circle