kaleidoscope.py

Created by antarctus

Created on July 25, 2022

375 Bytes

Dégradé continu, de couleur en couleur.


from kandinsky import *
from random import *

def color():
  return tuple(randint(0,255) for i in range(3))

c=color()
while True:
  new_c=color()
  step=max([abs(new_c[i]-c[i]) for i in range(3)])
  coeff=[(new_c[i]-c[i])/step for i in range(3)]
  for i in range(step):
    fill_rect(0,0,320,222,tuple(int(c[j]+coeff[j]*i) for j in range(3)))
  c=new_c