rain.py

Created by schraf

Created on November 02, 2022

415 Bytes

Version TikTok avec son


from kandinsky import fill_rect
from random import random
from time import sleep

coul = 0

while True:
  r = [0] * 160
  while min(r) != 12:
    nouv = 0
    for i,v in enumerate(r):
      if nouv < 3 and v == 0 and random() < .2:
        r[i] = 1
        nouv += 1
      elif 0 < v < 12: r[i] += 1
      if v != r[i]: fill_rect(2 * i, 0, 2, 20 * r[i],(coul,) * 3)
    sleep(.03)  
  coul = 255 - coul