Created
February 11, 2021 15:48
-
-
Save JayantGoel001/bb9b6c225347c6f21b2693fd00c4390a to your computer and use it in GitHub Desktop.
Creating A Rainbow Design using turtle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle as t | |
t.speed(5) | |
t.bgcolor('black') | |
r, g, b = 255, 0, 0 | |
for i in range(255 * 2): | |
t.colormode(255) | |
if i < 255 // 3: | |
g += 3 | |
elif i < 255 * 2 // 3: | |
r -= 3 | |
elif i < 255: | |
b += 3 | |
elif i < 255 * 4 // 3: | |
g -= 3 | |
elif i < 255 * 5 // 3: | |
r += 3 | |
else: | |
b -= 3 | |
t.forward(50 + i) | |
t.right(91) | |
t.pencolor(r, g, b) | |
t.hideturtle() | |
t.done() |
Author
JayantGoel001
commented
Feb 11, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment