我想制作一個在繪制時逐漸改變顏色的圖案,如下所示:#by the way this is in a loopturtle.fd(100)turtle.rt(30)turtle.fd(50)turtle.penup()turtle.goto(0,0)turtle.pendown()turtle.rt(3)#something here to change the color a little bit沒有顏色,這仍然是一個很酷的圖案,但我想知道如何使顏色逐漸從紅色變為黃色,再到綠色和藍色,然后最終變回紅色。
1 回答

梵蒂岡之花
TA貢獻1900條經驗 獲得超5個贊
import turtle
color = ['red','yellow','green','blue']
for i in range(100):
#by the way this is in a loop
turtle.color(color[i%4])
turtle.fd(100)
turtle.rt(30)
turtle.fd(50)
turtle.penup()
turtle.goto(0,0)
turtle.pendown()
turtle.rt(3)
#something here to change the color a little bit
這是一個不錯的選擇
- 1 回答
- 0 關注
- 169 瀏覽
添加回答
舉報
0/150
提交
取消