patterns — castshadow

generator verdict no votes yet
source — gen_a.g04_castshadow
def g04_castshadow(rng):
    """CAST SHADOW — a white plate with a black outline sits over a solid black
    copy of itself, offset by a quantised elevation. Elevation is a noise field,
    so the sheet reads as buckled."""
    N = 20
    c = Canvas(N, "GEOMETRIC", "squares", "castshadow", tiles=False)
    C = c.C
    nz = Value2D(rng, res=rng.choice([3, 4, 5]))
    dx = rng.choice([1, 1, -1])
    size = rng.uniform(0.62, 0.78) * C
    sw = rng.uniform(0.045, 0.075) * C
    shadows, plates = [], []
    for i in range(N):
        for j in range(N):
            u, v = (i + 0.5) / N, (j + 0.5) / N
            e = int(round(nz(u, v) * 2.49))          # 0,1,2 -> offsets of 0, C/2, C
            x, y = c.center(i, j)
            if e:
                shadows.append((x + dx * e * C / 2, y + e * C / 2))
            plates.append((x, y))
    for (x, y) in shadows:
        c.rect(x, y, size, size, fill="#000000")
    for (x, y) in plates:
        c.rect(x, y, size, size, fill="#FFFFFF", stroke="#000000", sw=sw)
    return c
castshadow-squares-20-21a5
castshadow-squares-20-21a5
castshadow-squares-20-eed1
castshadow-squares-20-eed1
castshadow-squares-20-9e54
castshadow-squares-20-9e54
castshadow-squares-20-87be
castshadow-squares-20-87be
castshadow-squares-20-4f0d
castshadow-squares-20-4f0d
castshadow-squares-20-8ca0
castshadow-squares-20-8ca0
castshadow-squares-20-6290
castshadow-squares-20-6290
castshadow-squares-20-e789
castshadow-squares-20-e789
castshadow-squares-20-c218
castshadow-squares-20-c218
castshadow-squares-20-4f67
castshadow-squares-20-4f67 erica ♥
castshadow-squares-20-a2b1
castshadow-squares-20-a2b1

generator