-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBatman Logo.py
78 lines (66 loc) · 2.46 KB
/
Batman Logo.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import turtle
import math
kalam = turtle.Turtle()
kalam.speed(500)
window = turtle.Screen()
window.bgcolor("#000000")
kalam.color("white")
k = 20
kalam.left(90)
kalam.penup()
kalam.goto(-7 * k, 0)
kalam.pendown()
for a in range(-7 * k, -3 * k, 1):
x = a / k
rel = math.fabs(x)
y = 1.5 * math.sqrt((-math.fabs(rel - 1)) * math.fabs(3 - rel) / ((rel - 1) * (3 - rel))) * (
1 + math.fabs(rel - 3) / (rel - 3)) * math.sqrt(1 - (x / 7) ** 2) + (
4.5 + 0.75 * (math.fabs(x - 0.5) + math.fabs(x + 0.5)) - 2.75 * (
math.fabs(x - 0.75) + math.fabs(x + 0.75))) * (1 + math.fabs(1 - rel) / (1 - rel))
kalam.goto(a, y * k)
for a in range(-3 * k, -1 * k - 1, 1):
x = a / k
rel = math.fabs(x)
y = (2.71052 + 1.5 - 0.5 * rel - 1.35526 * math.sqrt(4 - (rel - 1) ** 2)) * math.sqrt(
math.fabs(rel - 1) / (rel - 1))
kalam.goto(a, y * k)
kalam.goto(-1 * k, 3 * k)
kalam.goto(int(-0.5 * k), int(2.2 * k))
kalam.goto(int(0.5 * k), int(2.2 * k))
kalam.goto(1 * k, 3 * k)
print("Batman Logo with Python Turtle")
for a in range(1 * k + 1, 3 * k + 1, 1):
x = a / k
rel = math.fabs(x)
y = (2.71052 + 1.5 - 0.5 * rel - 1.35526 * math.sqrt(4 - (rel - 1) ** 2)) * math.sqrt(
math.fabs(rel - 1) / (rel - 1))
kalam.goto(a, y * k)
for a in range(3 * k + 1, 7 * k + 1, 1):
x = a / k
rel = math.fabs(x)
y = 1.5 * math.sqrt((-math.fabs(rel - 1)) * math.fabs(3 - rel) / ((rel - 1) * (3 - rel))) * (
1 + math.fabs(rel - 3) / (rel - 3)) * math.sqrt(1 - (x / 7) ** 2) + (
4.5 + 0.75 * (math.fabs(x - 0.5) + math.fabs(x + 0.5)) - 2.75 * (
math.fabs(x - 0.75) + math.fabs(x + 0.75))) * (1 + math.fabs(1 - rel) / (1 - rel))
kalam.goto(a, y * k)
for a in range(7 * k, 4 * k, -1):
x = a / k
rel = math.fabs(x)
y = (-3) * math.sqrt(1 - (x / 7) ** 2) * math.sqrt(math.fabs(rel - 4) / (rel - 4))
kalam.goto(a, y * k)
for a in range(4 * k, -4 * k, -1):
x = a / k
rel = math.fabs(x)
y = math.fabs(x / 2) - 0.0913722 * x ** 2 - 3 + math.sqrt(1 - (math.fabs(rel - 2) - 1) ** 2)
kalam.goto(a, y * k)
for a in range(-4 * k - 1, -7 * k - 1, -1):
x = a / k
rel = math.fabs(x)
y = (-3) * math.sqrt(1 - (x / 7) ** 2) * math.sqrt(math.fabs(rel - 4) / (rel - 4))
kalam.goto(a, y * k)
kalam.penup()
kalam.penup()
kalam.goto(25, -150)
kalam.pendown()
kalam.write('By Pallav', font=("Magenta Rose", 20))
turtle.done()