diff --git a/subwave_nowplaying.star b/subwave_nowplaying.star index 8742038..84d4079 100644 --- a/subwave_nowplaying.star +++ b/subwave_nowplaying.star @@ -12,6 +12,7 @@ load("cache.star", "cache") load("time.star", "time") load("animation.star", "animation") load("filter.star", "filter") +load("random.star", "random") DEFAULT_STATION_URL = "" NOWPLAYING_TTL = 20 @@ -478,19 +479,18 @@ def _glitch_jitter(zoom): pause = _glitch_hold(render.Box(width = ART_SLOT, height = ART_SLOT), GLITCH_PAUSE_TICKS) sequence = [] - state_index = 0 for cycle_index in range(GLITCH_REPEATS): for top1, h1, shift1, hue1, top2, h2, shift2, hue2 in _glitch_states_for_cycle(cycle_index): # The art itself nudges along with the bands, not just the # bands moving over a static image. Capped to +-1px -- a # full-frame shift reads very differently than a thin band - # shifting, so it stays subtle. Alternates +1/-1 by position - # in the sequence rather than deriving from shift1/shift2: - # several pool entries have those nearly or exactly - # cancel out (e.g. -2 and 2), which silently zeroed out the - # jitter in about half the states. - base_shift = 1 if state_index % 2 == 0 else -1 - state_index += 1 + # shifting, so it stays subtle. Randomized rather than a fixed + # alternating +1/-1 (which read as too mechanically regular, + # a predictable back-and-forth) or derived from shift1/shift2 + # (several pool entries have those nearly or exactly cancel + # out, e.g. -2 and 2, which silently zeroed out the jitter in + # about half the states). + base_shift = random.number(0, 2) - 1 # random.number requires min >= 0 state = render.Stack(children = [ _glitch_base_jitter(zoom, base_shift), # _glitch_band(zoom, top1, h1, shift1, hue1),