psyche5.py

Created by schraf

Created on August 15, 2022

414 Bytes


from math import sin,cos,atan2,pi
from random import random
from kandinsky import fill_rect,set_pixel

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

for v in range(0,222):
  for u in range(0,320):
    x=(u-160)*1.44/160
    y=(v-111)/111
    d=x*x+y*y
    d+=sin(20*atan2(x,y)*pi)*0.3*d*d
    gcol = COUL[int(abs(cos(d*10)*3-random()))]
    set_pixel(u,v,gcol)