亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

逐漸改變顏色(python)

逐漸改變顏色(python)

PHP
慕慕森 2023-11-09 14:55:27
我想制作一個在繪制時逐漸改變顏色的圖案,如下所示:#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

這是一個不錯的選擇


查看完整回答
反對 回復 2023-11-09
  • 1 回答
  • 0 關注
  • 169 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號