Explanation:
1. Import Libraries
import turtleimport time
- turtle draws the flower design.
- time adds pauses to make the animation visible.
2. Create the Screen
s = turtle.Screen()s.setup(750, 750)s.bgcolor("#080D1C")s.title("Peacock Feather Flower")
- Creates a 750 × 750 graphics window.
- Sets a dark navy background.
- Adds the title “Peacock Feather Flower”.
3. Configure the Turtle
t = turtle.Turtle()t.hideturtle()t.speed(0)t.pensize(2)
- Creates the drawing turtle.
- Hides the cursor.
- Sets the fastest drawing speed.
- Sets the pen thickness to 2.
4. Define Peacock Colors
colors = ["#00E5FF", "#167DCC", "#35E0A1", "#FFD166"]
Defines four colors: cyan, blue, green, and golden yellow.
5. Draw Feather-Shaped Petals
for i in range(12): t.penup() t.goto(0, 0) t.setheading(i * 30) t.pendown() t.pencolor(colors[i % 4])
- Repeats the loop 12 times.
- Moves the turtle to the center.
- Rotates each petal by 30°.
- Selects colors cyclically from the list.
t.circle(100, 60)t.left(120)t.circle(100, 60)t.left(120)
- Draws two curved arcs with radius 100.
- Turns left between the arcs.
- Creates a rounded, feather-like petal.
s.update()time.sleep(0.12)
Refreshes the screen and pauses for 0.12 seconds.
6. Add Peacock Feather Eyes
for i in range(12): t.penup() t.goto(0, 0) t.setheading(i * 30) t.forward(105) t.pendown()
- Creates 12 decorative feather-eye details.
- Rotates each detail by 30°.
- Moves 105 units outward from the center.
t.pencolor("#FFD166")t.circle(20)t.dot(18, "#167DCC")t.dot(8, "#00E5FF")
- Draws a golden circle with radius 20.
- Adds a blue dot.
- Adds a smaller cyan dot in the center.
7. Draw the Golden Center
t.penup()t.goto(0, -28)t.pendown()t.pencolor("#FFD166")t.fillcolor("#FFD166")t.begin_fill()t.circle(28)t.end_fill()t.dot(12, "#FF4FA3")
- Positions the turtle to draw a centered circle.
- Sets the outline and fill to golden yellow.
- Fills a circle with radius 28.
- Adds a pink dot for extra decoration.
8. Add Outer Decorative Dots
for i in range(36): t.penup() t.goto(0, 0) t.setheading(i * 10) t.forward(225) t.dot(5, colors[i % 4])
- Creates 36 colorful dots around the flower.
- Rotates by 10° for each dot.
- Places each dot 225 units from the center.
- Cycles through the four peacock-inspired colors.
s.update()time.sleep(0.025)
Refreshes the screen and adds a short animation pause.
9. Finish the Drawing
turtle.done()
Keeps the Turtle graphics window open after the drawing is complete.


0 Comments:
Post a Comment