Draw Batman logo


 

Batman THE MASKED HERO, ventures into Gotham City's underworld when a sadistic killer leaves behind a trail of cryptic clues and bring justice to the abuse of power and corruption that has long plagued the metropolis.

Code your own Bat mask now!

import turtle
import math

raj = turtle.Turtle()
raj.speed(500)

window = turtle.Screen()
window.bgcolor("#000000")
raj.color("yellow")

george = 20

raj.left(90)
raj.penup()
raj.goto(-7 * george, 0)
raj.pendown()

for a in range(-7 * george, -3 * george, 1):
    x = a / george
    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))
    raj.goto(a, y * george)

for a in range(-3 * george, -1 * george - 1, 1):
    x = a / george
    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))
    raj.goto(a, y * george)

raj.goto(-1 * george, 3 * george)
raj.goto(int(-0.5 * george), int(2.2 * george))
raj.goto(int(0.5 * george), int(2.2 * george))
raj.goto(1 * george, 3 * george)
print("Batman Logo with Python Turtle")
for a in range(1 * george + 1, 3 * george + 1, 1):
    x = a / george
    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))
    raj.goto(a, y * george)

for a in range(3 * george + 1, 7 * george + 1, 1):
    x = a / george
    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))
    raj.goto(a, y * george)

for a in range(7 * george, 4 * george, -1):
    x = a / george
    rel = math.fabs(x)
    y = (-3) * math.sqrt(1 - (x / 7) ** 2) * math.sqrt(math.fabs(rel - 4) / (rel - 4))
    raj.goto(a, y * george)

for a in range(4 * george, -4 * george, -1):
    x = a / george
    rel = math.fabs(x)
    y = math.fabs(x / 2) - 0.0913722 * x ** 2 - 3 + math.sqrt(1 - (math.fabs(rel - 2) - 1) ** 2)
    raj.goto(a, y * george)

for a in range(-4 * george - 1, -7 * george - 1, -1):
    x = a / george
    rel = math.fabs(x)
    y = (-3) * math.sqrt(1 - (x / 7) ** 2) * math.sqrt(math.fabs(rel - 4) / (rel - 4))
    raj.goto(a, y * george)

raj.penup()
begin_fill()
raj.goto(300, 300)
turtle.done()
raj.pendown()
end_fill()
hide_turtle()

Comments