From 97f7abfb2e11a9b40667ddffc1ea08f2c8a5daaa Mon Sep 17 00:00:00 2001 From: grmchn Date: Mon, 4 May 2026 19:54:47 +0900 Subject: [PATCH] fix: scale track point radius by output size --- nodes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index f89c7b9..af2e442 100644 --- a/nodes.py +++ b/nodes.py @@ -24,6 +24,7 @@ def _list_audio_wavs() -> list[str]: _MIN_RADIUS = 2 _MAX_RADIUS = 8 _MAX_TRAIL = 50 +_REF_SHORT_SIDE = 1080 # --------------------------------------------------------------------------- @@ -224,13 +225,16 @@ class DrawRhythmTracks(io.ComfyNode): coords = torch.stack([coords_x, coords_y], dim=-1) render_frames = torch.zeros(num_frames, height, width, 3, device=device) + radius_scale = min(width, height) / _REF_SHORT_SIDE for t in range(num_frames): start = max(0, t - _MAX_TRAIL) for source_frame in range(start, t + 1): age = t - source_frame ratio = 1.0 - age / _MAX_TRAIL - radius = _MIN_RADIUS + (_MAX_RADIUS - _MIN_RADIUS) * ratio + radius = ( + _MIN_RADIUS + (_MAX_RADIUS - _MIN_RADIUS) * ratio + ) * radius_scale color = _trail_color(ratio, device) x, y = coords[source_frame].tolist() _draw_filled_circle(render_frames[t], x, y, radius, color)