colorfulrings.py

Created by ews31415

Created on May 30, 2020

491 Bytes


from math import *
from kandinsky import *
from time import *

# color lists
r=[255,255,255,0,0,0,51,128,255]
g=[0,102,255,128,255,0,102,128,255]
b=[0,0,0,0,0,255,255,128,255]

# angles
a=list(range(128))
for i in range(128):
  a[i]=i/128*2*pi

# draw circles
for k in range(36):
  n=int(fmod(k,9))
  for j in range(50):
    for i in range(128):
      x=int(160+(20+j)*cos(a[i]))
      y=int(120+(20+j)*sin(a[i]))
      set_pixel(x,y,color(r[n],g[n],b[n]))
  sleep(0.1)