sign.py

Created by schraf

Created on January 15, 2023

628 Bytes


from kandinsky import *
from math import sin,cos
from random import *
from time import monotonic

fill_rect(0,0,320,222,(0,0,0))
COUL = (0,0,0),(248,0,0),(248,252,0),(248,252,248)

def s(n): return n>.05

while True:
  r=monotonic()/10
  for i in range(65):
    for j in range(45):
      if random()<.2:
        x,y=5*i,5*j
        e=x/120-cos(r)/4-.5
        f=y/120-sin(r)/4-1.3
        j=cos(2*r)*e-sin(r)*f/2-.3
        k=sin(r)*e/2+cos(2*r)*f+.5 
        n=s(j); m=s(k); n*=s(1-j); m*=s(1-k)
        c1=COUL.index(get_pixel(x,y))
        c2=max(0,min(3,n*m*2+c1-1))
        if c1!=c2:fill_rect(x,y,4,4,COUL[c2])