From 927a23e557fe247777904c97f2f3949beaf180f9 Mon Sep 17 00:00:00 2001 From: jim kolpack Date: Fri, 9 Oct 2026 16:13:01 -0400 Subject: [PATCH] Fix scanline loop-point flicker with an instantaneous snap-back The ramp-end keyframe and the next cycle's snap-back-to-0 keyframe were one tick apart, which got linearly interpolated -- for that one tick the pattern sat at a fractional, not-quite-zero offset instead of cleanly snapping, producing a brief flicker at each loop point. Fixed by giving both keyframes the exact same percentage (a zero-duration jump) instead. Also drops payload (425KB -> 364KB on the same test render) by removing a redundant near-duplicate frame per cycle. --- subwave_nowplaying.star | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/subwave_nowplaying.star b/subwave_nowplaying.star index aa93254..ed9419b 100644 --- a/subwave_nowplaying.star +++ b/subwave_nowplaying.star @@ -611,16 +611,22 @@ def _glitch_scanlines(): lines.append(render.Box(width = ART_SLOT, height = 1, color = "#00000000")) pattern = render.Column(children = lines) + # The ramp's end and the next cycle's snap-back share the exact same + # percentage (a zero-duration jump), rather than the snap landing one + # tick later -- that one-tick gap got linearly interpolated, which + # for a single tick showed the pattern at a fractional, not-quite-0 + # offset instead of cleanly snapping, producing a brief flicker right + # at the loop point. keyframes = [] for cycle in range(SCANLINE_CYCLES): cycle_start = cycle * _SCANLINE_CYCLE_TICKS - ramp_end = cycle_start + _SCANLINE_CYCLE_TICKS - 1 # last tick of the cycle is the snap back to 0 + cycle_end = cycle_start + _SCANLINE_CYCLE_TICKS # == next cycle's cycle_start keyframes.append(animation.Keyframe( percentage = float(cycle_start) / SCANLINE_SWEEP_DURATION, transforms = [animation.Translate(0, 0)], )) keyframes.append(animation.Keyframe( - percentage = float(ramp_end) / SCANLINE_SWEEP_DURATION, + percentage = float(cycle_end) / SCANLINE_SWEEP_DURATION, transforms = [animation.Translate(0, SCANLINE_SPACING)], curve = "linear", ))