Last active
September 18, 2024 16:32
-
-
Save Xnuvers007/fd727f19cc6ed1fe98d872a43fbd16a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
from math import pi, sin, cos | |
def draw_heart(w, h, iteration=0): | |
if iteration >= len(colors): | |
return | |
t = turtle.Turtle() | |
t.hideturtle() | |
t.pensize(2.5) | |
a = 0 | |
t.up() | |
t.fillcolor(colors[iteration]) | |
t.begin_fill() | |
while a < 2 * pi: | |
x = w * (16 * sin(a) ** 3) | |
y = h * (13 * cos(a) - 5 * cos(2 * a) - 2 * cos(3 * a) - cos(4 * a)) | |
t.goto(x, y) | |
a += 0.02 | |
t.down() | |
t.end_fill() | |
draw_heart(w - 3, h - 2, iteration + 1) | |
# Draw Text / gambar teks | |
if iteration == len(colors) - 1: # Only draw text in the last iteration / hanya gambar teks di iterasi terakhir | |
t.up() | |
t.color("black") | |
t.setpos(0, 0) | |
t.write("miss you Lily/Nhi <3", align="center", font=("verdana", 15, "bold")) | |
t.down() | |
colors = ['red', 'blue', 'green'] # add more colors if you want / tambahkan warna lain jika diperlukan | |
# Set up the screen / Setting layar | |
screen = turtle.Screen() | |
screen.setup(width=600, height=600) | |
screen.bgcolor("white") | |
screen.title("I Love You - ZYAA") | |
# Draw heart / Gambar hati <3 | |
draw_heart(16, 16) | |
# Keep the window open / membiatkan jendela tidak ditutup | |
turtle.done() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
video = https://www.tiktok.com/@luckysora25/video/7355646340283698437
github = Xnuvers007
instagram = indradwi.25
-> https://xnuvers007.github.io/