vagues2.py

Created by schraf

Created on October 15, 2021

652 Bytes


from kandinsky import *
from random import random
from math import sin

bleus=[(0,0,0),(32,64,152),(56,148,248),(56,180,248)]
fill_rect(0,0,320,222,(0,0,0))
t = 0
d = 1

while True:
  a=40*random()
  for c in range(480//d):
    for l in range(60//d):
       x = int(d * (c - 10 * t))
       y = int(100 + a + .2 * l * sin(t+3.14*c/36))
       t += .1
       if t < 3 and random() > .3:
         v = get_pixel(x+1,y+1)
         r = 1+bleus.index(v)
       else: r = 0
       if t > 6: t = 0
       fill_rect(x,y,d,d,bleus[r%len(bleus)])
       for i in range(2):
        fill_rect(int(x-160*random()),int(y+20-100*random()),d,d,(0,0,0))