【发布时间】:2022-10-14 23:52:32
【问题描述】:
“练习 52:彩虹三角形
使用stroke()为旋转三角形草图的每个三角形着色。"
它应该如下所示:
上面是图片 我的代码:
def setup():
colorMode(HSB)
size(600,600)
t = 0
def draw():
global t
background(255)#white
translate (width/2, height/2)
for i in range(90):
stroke(3*i,255,255)
rotate(radians(360/90))
pushMatrix()
translate(200,0)
rotate(radians(t+2*i*360/90))
tri(100)
popMatrix()
t += 0.5
def tri(length):
noFill()
triangle(0, -length, -length*sqrt(3)/2, length/2, length*sqrt(3)/2, length/2)
我的代码实际上创建了彩虹三角形,但我不允许使用 colorMode()
【问题讨论】:
标签: processing