illusion7.py

Created by schraf

Created on August 19, 2022

570 Bytes


from kandinsky import fill_rect
from time import sleep

COUL = ((30,255,255),(0,40,255),(0,0,0),(255,)*3)

fill_rect(0,0,320,222,COUL[0])

t, nb, p = 22, 1, 1
w, h = 320 // t, 222 // t
p = 1

for l in range(1+h):
  for c in range(1+w):
    if (l + c) % 2 : fill_rect(t*c,t*l,t,t,COUL[1])

while True:
  for l in range(h):
    for c in range(w):
      g = COUL[2 if nb else 3]
      if p or c+l+(c>3)+(c>9)+(l>1)+(l>6) & 1:
        fill_rect(t - 6 + t*c,t - 1 + t*l,12,3,g)
        fill_rect(t - 1 + t*c,t - 6 + t*l,3,12,g)
  nb, p = 1 - nb, 0
  sleep(2)