add fancy backgrounds (one of them)

This commit is contained in:
Yonokid
2025-05-12 03:10:39 -04:00
parent 83780a1734
commit 283a2bc04b
6 changed files with 156 additions and 45 deletions

View File

@@ -86,8 +86,10 @@ class FadeAnimation(BaseAnimation):
class MoveAnimation(BaseAnimation):
def __init__(self, duration: float, total_distance: int = 0,
start_position: int = 0, delay: float = 0.0,
reverse_delay: Optional[float] = None,
ease_in: Optional[str] = None, ease_out: Optional[str] = None):
super().__init__(duration, delay)
self.reverse_delay = reverse_delay
self.total_distance = total_distance
self.start_position = start_position
self.ease_in = ease_in
@@ -100,7 +102,14 @@ class MoveAnimation(BaseAnimation):
elif elapsed_time >= self.delay + self.duration:
self.attribute = self.start_position + self.total_distance
self.is_finished = True
if self.reverse_delay is not None:
self.start_ms = current_time_ms
self.delay = self.reverse_delay
self.start_position = self.start_position + self.total_distance
self.total_distance = -(self.total_distance)
self.reverse_delay = None
else:
self.is_finished = True
else:
progress = (elapsed_time - self.delay) / self.duration
progress = self._apply_easing(progress, self.ease_in, self.ease_out)
@@ -194,6 +203,7 @@ class Animation:
duration: Length of the move in milliseconds
start_position: The coordinates of the object before the move
total_distance: The distance travelled from the start to end position
reverse_delay: If provided, move will play in reverse after this delay
delay: Time to wait before starting the move
ease_in: Control ease into the move
ease_out: Control ease out of the move

View File

@@ -1,3 +1,4 @@
import hashlib
import math
from collections import deque
from dataclasses import dataclass, field, fields
@@ -375,6 +376,10 @@ class TJAParser:
note = Balloon(note)
note.count = int(balloon[balloon_index])
balloon_index += 1
elif item == '8':
new_pixels_per_ms = play_note_list[-1].pixels_per_frame / (1000 / 60)
note.load_ms = note.hit_ms - (self.distance / new_pixels_per_ms)
note.pixels_per_frame = play_note_list[-1].pixels_per_frame
self.current_ms += increment
play_note_list.append(note)
self.get_moji(play_note_list, ms_per_measure)
@@ -389,3 +394,10 @@ class TJAParser:
draw_note_list = deque(sorted(play_note_list, key=lambda n: n.load_ms))
bar_list = deque(sorted(bar_list, key=lambda b: b.load_ms))
return play_note_list, draw_note_list, bar_list
def hash_note_data(self, notes: list):
n = hashlib.sha256()
for bar in notes:
for part in bar:
n.update(part.encode('utf-8'))
return n.hexdigest()