import turtle
import math
# Set up the turtle window
t = turtle.Turtle()
t.hideturtle()
t.getscreen().bgcolor('#f7e6f5')
t.speed(0)# Set up the heart shapedefcurve(x):return math.sin(x)
t.penup()
t.goto(0,150)
t.pendown()
t.color('purple','pink')
t.begin_fill()for i inrange(-180,180):
x = curve(i /10)*100
y = math.sin(math.radians(i))*100
t.goto(x, y +150)
t.end_fill()# Set up the animation
t.penup()
t.color('#f8c3cd')
t.goto(0,0)
t.pendown()
t.pensize(5)
t.speed(5)for i inrange(200):
t.forward(1)
x = t.xcor()
y = t.ycor()ifabs(x)<10and y >100:
t.color('#f8c3cd','#f9a7b0')elifabs(x)>90or y <-70:
t.color('#f8c3cd','#f9a7b0')elif y <-50:
t.color('#f8c3cd','#f6a8c6')elif y <0:
t.color('#f8c3cd','#e7b7dd')