def g06_phasebars(rng):
"""PHASE BARS — one full-height bar per cell, width modulated by a sine whose
phase advances down the column. The stack shears into a travelling wave."""
N = 50
c = Canvas(N, "GEOMETRIC", "squares", "phasebars", tiles=True)
C = c.C
P = rng.choice([5, 6, 8, 10])
Q = rng.choice([12, 16, 20, 25])
skew = rng.uniform(-0.6, 0.6)
base = rng.uniform(0.34, 0.46)
amp = rng.uniform(0.26, 0.40)
for i in range(N):
for j in range(N):
ph = (i / P + j / Q + skew * (i * j) / (N * N)) * math.tau
w = base + amp * math.sin(ph)
if w > 0.02:
x, y = c.center(i, j)
c.rect(x, y, w * C, C)
return c