Create Awesome Heart Graphics Using Python Turtle

Publicado em: 28 Novembro 2024
no canal de: WebDamn - A Coders Point
643
13

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()


Nesta página do site você pode assistir ao vídeo on-line Create Awesome Heart Graphics Using Python Turtle duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário WebDamn - A Coders Point 28 Novembro 2024, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 643 vezes e gostou 13 espectadores. Boa visualização!