-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (30 loc) · 1.22 KB
/
Copy pathmain.py
File metadata and controls
36 lines (30 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import turtle #Importing Turtle module
import math #Importing Math Module
#equation of love function
#It is a parametric function
#you will see the eqution in right side
#We need to import math module
def lovecurve(t):
x = 16 * (math.sin(t) ** 3)
y = 13 * math.cos(t) - 5 * math.cos(2 * t) - 2 * math.cos(3 * t) - math.cos(4 * t)
return x,y # it will return a tuple
turtle.setup(800,800) #Screen size of turtle drawing
turtle.title("Love Drawing") #Canvas name
turtle.bgcolor("black") #Background color
turtle.pensize(2) #width of line
turtle.pencolor("red") #line color
turtle.speed(0.1) #it will fast the drawing
factor = 20
# Now its time to draw the love curve
turtle.penup() #it removes the first line from center
for i in range(0,400):
x, y = lovecurve(i) # x,y are the co-ordinates
turtle.goto(x * factor , y * factor)
turtle.pendown()
turtle.getcanvas().postscript(file="lovedrawing.eps")
turtle.exitonclick() # exit from the turtle window when click mouse
# Now let's see what happen
# we should add here some factor to bigger the love
# Now we need to remove the line from center
#Great!!!!! Thank you for wathcing the video
#Plese subscribe my channel for more video