techno.py

Created by schraf

Created on August 09, 2025

806 Bytes

Animation TikTok
En savoir plus (Learn more)


import kandinsky as kd
import time
import random
import math

sh = 222
sw = 320

xc = sw / 2
yc = sh / 2
rad = sh / 40
a = random.random()


while True:
    kd.fill_rect(0, 0, sw, sh, kd.color(0, 0, 0))  # CLS
    a += .001
    if a > 0.86: a *= 0.86
    if a < 0.1: a += 0.1
    if a == 0.5: a = 0.4999
    
    b = 0.9998
    p = 2000
    c = 2 - 2 * a
    x = 0
    y = 12.17
    w = a * x + c * x * x / (1 + x * x)

    for h in range(p + 1):
        if h > 150:
            px = int(x * rad + xc)
            py = int(y * rad + yc)
            if 0 <= px < sw and 0 <= py < sh:
                kd.set_pixel(px, py, (255, 255, 0))
            
        z = x
        x = b * y + w
        u = x * x
        w = a * x + c * u / (1 + u)
        y = w - z

    time.sleep(.1)  # Pause 300 ms

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.