Complete source code to create awesome heart graphics using Python Turtle.
Source code:
import math
from turtle import*
def heart_x(k):
return 15*math.sin(k)**3
def heart_y(k):
return 12*math.cos(k)-5*\
math.cos(2*k)-2*\
math.cos(3*k)-\
math.cos(4*k)
screen = Screen()
window_width, window_height = 400, 650
screen.setup(width=window_width, height=window_height)
screen.title("Heart Animation")
bgcolor("black")
heart_width = 30
heart_height = 22
scaling_factor = min((window_width / 2) / heart_width, (window_height / 2) / heart_height) * 0.9
speed (0)
bgcolor("black")
for i in range(600):
goto(heart_x(i)*scaling_factor,heart_y(i)*scaling_factor)
for j in range(5):
color("red")
goto(0,0)
goto(0, -scaling_factor * (heart_height + 2))
color("red")
write("Love", align="center", font=("Arial", 24, "bold"))
done()
En esta página del sitio puede ver el video en línea Create Awesome Heart Graphics Using Python Turtle de Duración hora minuto segunda en buena calidad , que subió el usuario WebDamn - A Coders Point 28 noviembre 2024, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 643 veces y le gustó 13 a los espectadores. Disfruta viendo!