A simple flying bird with wings drawn in an upward motion, simulating the flight. You can adjust the wing positions further to animate the bird in flight.
Code :
import turtle
t = turtle.Turtle()
t.speed(3)
def draw_body():
t.fillcolor(“blue”)
t.begin_fill()
t.circle(50)
t.end_fill()
def draw_head():
t.penup()
t.goto(-70, 80)
t.pendown()
t.fillcolor(“lightblue”)
t.begin_fill()
t.circle(30)
t.end_fill()
def draw_beak():
t.penup()
t.goto(-90, 80)
t.pendown()
t.fillcolor(“orange”)
t.begin_fill()
t.setheading(30)
for _ in range(3):
t.forward(20)
t.left(120)
t.end_fill()
def draw_eye():
t.penup()
t.goto(-85, 100)
t.pendown()
t.dot(10, “black”)
def draw_wings():
t.penup()
t.goto(-10, 70)
t.pendown()
t.fillcolor(“lightblue”)
t.begin_fill()
t.setheading(-90)
t.circle(50, 180)
t.end_fill()
t.penup()t.goto(-10, 30)t.pendown()t.fillcolor("lightblue")t.begin_fill()t.setheading(90)t.circle(50, 180)t.end_fill()t.penup() t.goto(-10, 30) t.pendown() t.fillcolor("lightblue") t.begin_fill() t.setheading(90) t.circle(50, 180) t.end_fill()t.penup() t.goto(-10, 30) t.pendown() t.fillcolor("lightblue") t.begin_fill() t.setheading(90) t.circle(50, 180) t.end_fill()
Enter fullscreen mode Exit fullscreen mode
draw_body()
draw_head()
draw_beak()
draw_eye()
draw_wings()
t.hideturtle()
turtle.done()
Break the code:
- Wings in a Flying Position: The wings are drawn with semicircles positioned to appear as if the bird is flapping them upwards, giving the impression of flight.
- Body, Head, Beak, Eye: These elements remain the same as in the previous code, with minor adjustments for positioning.
Learn Java script with programs
暂无评论内容