Alexandre B A Villares 2020-07-02 22:34:29 -03:00
rodzic a0d8585b95
commit cbe47553cb
2 zmienionych plików z 28 dodań i 0 usunięć

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 150 KiB

Wyświetl plik

@ -0,0 +1,28 @@
n = 32
t = 0
def setup():
global s
noStroke()
frameRate(2)
size(320, 320)
def draw():
s = width / n
textAlign(CENTER, CENTER)
textSize(14)
colorMode(HSB)
for x in range(n):
for y in range(n):
c = (frameCount + y) ** 2
bv = left_padded_bin(c, n)
if bv[x] == '0':
fill(0)
else:
fill(255)
rect(x * s, y * s, s, s)
def left_padded_bin(v, n):
f = '{{:0{}b}}'.format(n)
return f.format(v)