sv2023.py

Created by schraf

Created on February 07, 2023

674 Bytes

A court d’idée pour la Saint-Valentin ? Offrez-lui ce script pour sa Numworks ! 💝💗💖

Version TikTok

📺 Découvrez ma chaine Youtube


from turtle import *
from math import *
from random import randint
from kandinsky import get_pixel

speed(0)

def coeur(x0, y0, d, coul, e = 1):
 pensize(e)
 color(coul)
 penup()
 goto(x0, y0 + 5 * d)
 pendown()
 for t in range(20):
  r = radians(18 * t)
  x = 16 * sin(r) ** 3
  y = 13 * cos(r) - 5 * cos(2 * r) - 2 * cos(3 * r) - cos(4 * r)
  goto(x0 + d * x, y0 + d * y)

for d in range(8): coeur(0, 15, d, (240, 252, 248), 3)

while True:
 ko = True
 while ko:
  x0, y0 = randint(40, 280), randint(5, 215)
  if get_pixel(x0, y0)[0] <= 247: ko = False
 c = randint(150, 255)
 coul, e = (c, 255 - c, c), randint(1, 2)
 coeur(x0 - 160, 110 - y0, .3, coul, e)