Reputation:
I want to make a pattern that gradually changes color as it is being drawn, something like this:
#by the way this is in a loop
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
Without the color, this is still a pretty cool pattern, but I want to know how to make the color gradually change from, say red, to yellow to green and blue then back to red eventually.
Upvotes: 1
Views: 1191
Reputation: 2721
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
This is a good option
Upvotes: 2