import turtle as t |
import time |
t.speed( 0 ) |
|
t.ht() # 隐藏画笔 |
z = 0 |
while True : |
t.clear() # 清空面板 |
|
# 风车杆 |
t.seth( 0 ) # 设置角度为0度。 |
t.pensize( 8 ) # 设置画笔粗细 |
t.pencolor( "skyblue" ) # 设置画笔颜色 |
t.right( 110 ) |
t.fd( 200 ) |
# 回归原点 |
t.pu() |
t.home() |
t.pd() |
|
t.tracer( 0 ) |
time.sleep( 0.03 ) |
t.seth(z) # 设置角度控制风车旋转 |
t.pensize( 1 ) # 画笔粗细重置为1 |
|
# 风车 |
for i in range ( 4 ): |
# 大三角 |
t.color( "tan1" ) |
t.begin_fill() |
t.fd( 80 ) |
t.left( 135 ) |
t.fd( 80 / 1.41 ) |
t.lt( 90 ) |
t.fd( 80 / 1.41 ) |
t.lt( 135 ) |
t.end_fill() |
|
# 小三角 |
t.color( "tan3" ) |
t.begin_fill() |
t.left( 45 ) |
t.fd( 80 / 1.41 ) |
t.left( 135 ) |
t.fd( 40 ) |
t.left( 90 ) |
t.fd( 40 ) |
t.left( 90 ) |
t.end_fill() |
|
t.left( 90 ) # 由一个风车扇叶旋转4次,得到四个风车扇叶 |
t.dot( 8 , "tan4" ) # 风车中心的钉子 |
|
t.update() |
z = z + 10 # 角度 |