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