Commit 61f95a66 by BellCodeEditor

auto save

parent c20f0945
Showing with 101 additions and 0 deletions
每次移动都增加画笔移动的长度,并旋转91°,重复执行300次,查看效果
"""
import turtle
pen = turtle.Pen()
for i in range(300):
pen.forward(i)
pen.right(91)
pen.hideturtle()
pen.done()
import turtle as t
t.speed(0)
def draw(r):
# 画一个风车的棒子
t.pensize(4) # 棒子4像素粗
t.penup()
t.goto(0,0)
t.pendown()
t.goto(0,-150)
t.pensize(1)
for i in range(4):
t.setheading(i * 90 + r)
t.penup()
t.goto(0,0)
t.pendown()
# 浅蓝色三角形
t.fillcolor('#50B2F8')
t.begin_fill()
t.forward(100)
t.left(150)
t.forward(70)
t.end_fill()
# 靠近中心的深蓝色三角形
t.fillcolor('#063EC5')
t.begin_fill()
t.left(30)
t.forward(40)
t.left(90)
t.forward(35)
t.end_fill()
draw(30) # 尝试不同的角度,叶子已经可以转到我们想要的角度了
t.done()
for r in range(0,360*100,3): # 这里是旋转100圈,也可以用while循环,让它不停转,步长3对应的是转速,也可以改为1、2看看效果
t.tracer(False)
t.clear()
draw(r)
time.sleep(0.01)
t.hideturtle()
t.tracer(True)
import turtle as t
import time
def draw(r):
# 画一个风车的棒子
t.pensize(4) # 棒子4像素粗
t.penup()
t.goto(0,0)
t.pendown()
t.goto(0,-150)
t.pensize(1)
for i in range(4):
t.setheading(i * 90 + r)
t.penup()
t.goto(0,0)
t.pendown()
# 浅蓝色三角形
t.fillcolor('#50B2F8')
t.begin_fill()
t.forward(100)
t.left(150)
t.forward(70)
t.end_fill()
# 靠近中心的深蓝色三角形
t.fillcolor('#063EC5')
t.begin_fill()
t.left(30)
t.forward(40)
t.left(90)
t.forward(35)
t.end_fill()
# 用速度1播放一次绘制过程
t.speed(1)
draw(0)
for r in range(0,360*100,3): # 这里是旋转100圈,也可以用while循环,让它不停转,步长3对应的是转速,也可以改为1、2看看效果
t.tracer(False)
t.clear()
draw(r)
time.sleep(0.01)
t.hideturtle()
t.tracer(True)
t.done()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment