tixy2.py

Created by schraf

Created on March 04, 2024

604 Bytes


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

ms = .01
fill_rect(0, 0, 320, 222, (0, 0, 0))

def f(t, i, x, y): return sin(t-sqrt((x-7.5)**2+(y-6)**2))

def hypot(a, b): return sqrt(a * a + b * b)

def carre(x, y, v):
 t = int(14 * v)
 g, h = 64 + 14 * x, 15 + 14 * y
 coul = (255 + 255 * v,) * 3
 fill_rect(g - 6 + t, h - 6, 14 - t, 14, (0,0,0))
 fill_rect(g - 6, h - 6, t, 14, coul)

def tixy():
 t = 0
 while True:
  for i in range(256):
   x, y = i % 16, i // 16
   v = min(1, max(-1, f(t, i, x, y)))
   carre(x, y, v)
  sleep(ms)
  t += ms

tixy()

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 <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.