Why choose python
Well if you are a beginer in coding or you are an advance coder then you know that we can create animiation in C and C++ language. But I will said that if you are a beginer then you should start with a simple and easy language whic is python. For this reason we choose python.
Only animation?
If you are thinking that the power of programming languages is only to drawing. Then you are absolutly wrong. The power of coding is unlimited you can use python to automate a system even hackers also use python wisely hence it has easy commond and syntax. We use to draw some interesting stuffs because it will increase your will to learn coding. As the time will go we will dive into some advance project. So don't be bored just stay tuned.
What is required module
We will use the turtle module in this project.
Logic of the project
Well we will not use any heigh level algorithm which can be tough for you to understand. We just use a simple method. A method to draw a curve in turtle using for loop. By joining the small curve with other small curve we can create the logo. Because the logo is basically a summation of small curves. So it will not be so hard to understand. Still if you can't understand it you can comment. I will try to explain more easily.
Source Code
from turtle import *
speed(250)
bgcolor('#fcb103')
penup()
goto(-200,100)
pendown()
fillcolor('black')
begin_fill()
def upper_part():
forward(150)
right(90)
for i in range(55):
forward(0.3)
left(1)
for i in range(50):
forward(0.2)
left(0.5)
left(10)
forward(20)
# start of the sing
left(80)
forward(17)
right(160)
forward(10)
left(80)
# end of the sing
forward(17)
left(80)
forward(10)
right(160)
forward(17)
left(80)
forward(10)
for i in range(50):
left(0.5)
forward(0.2)
for i in range(55):
forward(0.3)
left(1)
right(80)
forward(150)
left(180)
upper_part()
def lower_part():
left(5)
for i in range(30):
forward(1.5)
left(1)
for i in range(48):
forward(1)
left(1.5)
right(110)
forward(55)
for i in range(35):
forward(2)
left(1)
for i in range(36):
forward(0.6)
left(1)
right(136.5986)
for i in range(36):
left(1)
forward(0.6)
for i in range(35):
left(1)
forward(2)
forward(55)
right(110)
for i in range(48):
left(1.5)
forward(1)
for i in range(30):
left(1)
forward(1.5)
hideturtle()
lower_part()
end_fill()
done()
Comments
Post a Comment