patterns — shells

generator verdict no votes yet
source — gen_a.g03_shells
def g03_shells(rng):
    """RADIAL FALLOFF — dot radius set by distance from two off-centre foci,
    rippled by a cosine so the falloff breaks into concentric shells. The ripple
    rides on a floor, so shells thin out rather than vanishing."""
    N = 32
    c = Canvas(N, "GEOMETRIC", "dots", "shells", tiles=False)
    C = c.C
    fx1, fy1 = rng.uniform(.1, .5), rng.uniform(.1, .5)
    fx2, fy2 = rng.uniform(.5, .95), rng.uniform(.5, .95)
    rip = rng.uniform(4, 10)
    bias = rng.uniform(0.6, 1.0)
    floor = rng.uniform(0.30, 0.50)
    for i in range(N):
        for j in range(N):
            u, v = (i + 0.5) / N, (j + 0.5) / N
            d1 = math.hypot(u - fx1, v - fy1)
            d2 = math.hypot(u - fx2, v - fy2)
            d = min(d1, d2 * bias)
            t = clamp(1.15 - d * 1.15)
            t *= floor + (1 - floor) * (0.5 + 0.5 * math.cos(d * rip * math.tau))
            r = 0.54 * C * clamp(t) ** 0.6
            if r > 0.03 * C:
                x, y = c.center(i, j)
                c.circle(x, y, r)
    return c
shells-dots-32-05b8
shells-dots-32-05b8
shells-dots-32-c77e
shells-dots-32-c77e
shells-dots-32-245f
shells-dots-32-245f
shells-dots-32-718b
shells-dots-32-718b
shells-dots-32-20cd
shells-dots-32-20cd
shells-dots-32-4965
shells-dots-32-4965
shells-dots-32-6113
shells-dots-32-6113
shells-dots-32-43ff
shells-dots-32-43ff
shells-dots-32-5912
shells-dots-32-5912
shells-dots-32-dd61
shells-dots-32-dd61
shells-dots-32-125d
shells-dots-32-125d

generator