复杂对称图案设计 15.6
Python
def complex_mandala(layers, initial_radius, color_scheme):
"""绘制复杂曼陀罗图案"""
colors = color_scheme
for layer in range(layers):
radius = initial_radius * (layer + 1)
petals = 6 + layer * 2
color = colors[layer % len(colors)]
t.penup()
t.goto(0, -radius)
t.pendown()
t.pencolor(color)
# 绘制当前层
for i in range(petals):
# 花瓣外弧
t.circle(radius, 60)
# 花瓣内弧
t.circle(radius/3, 60)
t.circle(radius, 60)
t.right(360/petals)
# 绘制曼陀罗
t.clear()
t.home()
color_scheme = ["red", "orange", "yellow", "green", "blue", "purple"]
complex_mandala(6, 20, color_scheme)