heart.py

Created by schraf

Created on October 16, 2022

1021 Bytes

```from turtle import *
from math import *
from kandinsky import fill_rect

speed(0) ; hideturtle()

fill_rect(0,0,320,222,(0,0,0))

def clou(A):
pensize(5) ; color((160,140,130))
penup(); goto(A); pendown(); goto(A)

def fil(A,B,c):
clou(A); pensize(1); pencolor(c)
goto(B); clou(B)

def Ce(R,N,n,D=1,d=0):
return [R*sin(2*pi*(n+d/D)/N), R*cos(2*pi*(n+d/D)/N)]

c = (175,220,240)

for i in range(14):
fil(Ce(100,80,-14+2*i),Ce(100,80,-13+2*i),c)
fil(Ce(100,80,-13+2*i),Ce(100,80,14+4*i),c)
if i != 13:
fil(Ce(100,80,14+4*i),Ce(100,80,15+4*i),c)
fil(Ce(100,80,15+4*i),Ce(100,80,16+4*i),c)
fil(Ce(100,80,16+4*i),Ce(100,80,-12+2*i),c)

c = (250,160,150)
pts1 = (40,2),(54,2),(68,4),(14,2),(28,2)
pts2 = (28,2),(29,2),(15,2),(70,4),(55,2),(41,2),(42,2)

for i in range(7):
for j,(a,b) in enumerate(pts1[:-1]):
fil(Ce(100,80,a+b*i),Ce(100,80,pts1[j+1][0]+pts1[j+1][1]*i),c)
if i != 6:
for k,(u,v) in enumerate(pts2[:-1]):
fil(Ce(100,80,u+v*i),Ce(100,80,pts2[k+1][0]+pts2[k+1][1]*i),c)```