# I AM IRONMAN with animation

# project structure

+-- ironman-animation
|    +-- ironman_helmet.py
|    +-- main.py
|    +-- points.py
1
2
3
4

ironman_helmet.py

def draw_ironman_helmet(turtle,points,color):
    turtle.penup()
    turtle.goto(points[0])
    turtle.pendown()
    turtle.color(color) 
    turtle.begin_fill()

    for i in range(1, len(points)):
        x, y = points[i]
        turtle.goto(x, y)

    turtle.end_fill()
1
2
3
4
5
6
7
8
9
10
11
12

points.py

ankur1 = [
        [0, 120],
        ...
        [40, 120],
        [0, 120],
]

ankur2 = [
        [0, -30],
        ...
        [40, -30],
        [0, -30],
]

ankur3 = [
        [0, -220],
        ...
        [60, -220],
        [0, -220],
]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

download points.py

main.py

from turtle import Screen, Turtle
from ironman_helmet import draw_ironman_helmet
from points import ankur1, ankur2, ankur3
from time import sleep


def main():

        screen = Screen()
        screen.setup(500,600)
        screen.title("I AM IRONMAN")
      
        my_turtle = Turtle()
        my_turtle.hideturtle()

        for i in range(10):
                screen.bgcolor("#ba161e")
                my_turtle.clear()
                color = "#fab104"
                draw_ironman_helmet(my_turtle, ankur1, color)
                draw_ironman_helmet(my_turtle, ankur2, color)
                draw_ironman_helmet(my_turtle, ankur3, color)
                
                sleep(1)

                screen.bgcolor("blue")
                my_turtle.clear()
                color = "pink"
                draw_ironman_helmet(my_turtle, ankur1, color)
                draw_ironman_helmet(my_turtle, ankur2, color)
                draw_ironman_helmet(my_turtle, ankur3, color)

                sleep(1)

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

# (Optional) Remove drawing animation

main.py












 











 









 





from turtle import Screen, Turtle
from ironman_helmet import draw_ironman_helmet
from points import ankur1, ankur2, ankur3
from time import sleep


def main():

        screen = Screen()
        screen.setup(500,600)
        screen.title("I AM IRONMAN")
        screen.tracer(0)
      
        my_turtle = Turtle()
        my_turtle.hideturtle()

        for i in range(10):
                screen.bgcolor("#ba161e")
                my_turtle.clear()
                color = "#fab104"
                draw_ironman_helmet(my_turtle, ankur1, color)
                draw_ironman_helmet(my_turtle, ankur2, color)
                draw_ironman_helmet(my_turtle, ankur3, color)
                screen.update()

                sleep(1)

                screen.bgcolor("blue")
                my_turtle.clear()
                color = "pink"
                draw_ironman_helmet(my_turtle, ankur1, color)
                draw_ironman_helmet(my_turtle, ankur2, color)
                draw_ironman_helmet(my_turtle, ankur3, color)
                screen.update()


                sleep(1)

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