Randomize base jitter instead of a fixed +1/-1 alternation
Fixed +1/-1 alternation read as too mechanically regular -- a
predictable back-and-forth. Now picks randomly from {-1, 0, 1} per
burst state via random.star (random.number(0, 2) - 1, since
random.number requires a non-negative minimum).
This commit is contained in:
1 parent
4983e81a24
commit
3273212bfe
1 file changed
+8
-8
@@ -12,6 +12,7 @@ load("cache.star", "cache")
|
|||||||
load("time.star", "time")
|
load("time.star", "time")
|
||||||
load("animation.star", "animation")
|
load("animation.star", "animation")
|
||||||
load("filter.star", "filter")
|
load("filter.star", "filter")
|
||||||
|
load("random.star", "random")
|
||||||
|
|
||||||
DEFAULT_STATION_URL = ""
|
DEFAULT_STATION_URL = ""
|
||||||
NOWPLAYING_TTL = 20
|
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)
|
pause = _glitch_hold(render.Box(width = ART_SLOT, height = ART_SLOT), GLITCH_PAUSE_TICKS)
|
||||||
|
|
||||||
sequence = []
|
sequence = []
|
||||||
state_index = 0
|
|
||||||
for cycle_index in range(GLITCH_REPEATS):
|
for cycle_index in range(GLITCH_REPEATS):
|
||||||
for top1, h1, shift1, hue1, top2, h2, shift2, hue2 in _glitch_states_for_cycle(cycle_index):
|
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
|
# The art itself nudges along with the bands, not just the
|
||||||
# bands moving over a static image. Capped to +-1px -- a
|
# bands moving over a static image. Capped to +-1px -- a
|
||||||
# full-frame shift reads very differently than a thin band
|
# full-frame shift reads very differently than a thin band
|
||||||
# shifting, so it stays subtle. Alternates +1/-1 by position
|
# shifting, so it stays subtle. Randomized rather than a fixed
|
||||||
# in the sequence rather than deriving from shift1/shift2:
|
# alternating +1/-1 (which read as too mechanically regular,
|
||||||
# several pool entries have those nearly or exactly
|
# a predictable back-and-forth) or derived from shift1/shift2
|
||||||
# cancel out (e.g. -2 and 2), which silently zeroed out the
|
# (several pool entries have those nearly or exactly cancel
|
||||||
# jitter in about half the states.
|
# out, e.g. -2 and 2, which silently zeroed out the jitter in
|
||||||
base_shift = 1 if state_index % 2 == 0 else -1
|
# about half the states).
|
||||||
state_index += 1
|
base_shift = random.number(0, 2) - 1 # random.number requires min >= 0
|
||||||
state = render.Stack(children = [
|
state = render.Stack(children = [
|
||||||
_glitch_base_jitter(zoom, base_shift),
|
_glitch_base_jitter(zoom, base_shift),
|
||||||
# _glitch_band(zoom, top1, h1, shift1, hue1),
|
# _glitch_band(zoom, top1, h1, shift1, hue1),
|
||||||
|
|||||||