vagues.py

Created by schraf

Created on July 26, 2021

835 Bytes


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

# Les types de bleus
bleus=[(0,0,0),(32,64,152),(56,148,248),(56,180,248)]
# Ecran noir
fill_rect(0,0,320,222,(0,0,0))
t = 0
d = 2

while True:
  # c = colonne, l = ligne
  for c in range(480//d):
    for l in range(60//d):
       # carré que l'on va changer de couleur
       x = int(d * (c - 10 * t))
       y = int(100 + 2 * l * sin(t + 3.14 * c / 36))
       t += .1
       # Soit le bleu suivant soit du noir
       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
       # Dessin du rectangle
       # et on met en noir 2 rectangles 
       fill_rect(x,y,d,d,bleus[r%len(bleus)])
       fill_rect(x-160,y,d,d,(0,0,0))
       fill_rect(x-75,y,d,d,(0,0,0))

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.