Created
October 3, 2014 13:59
-
-
Save Uko/eea47e506286b816d41d to your computer and use it in GitHub Desktop.
This file contains 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 | |
def circle(radius = 50, segments = 60): | |
turn_step = 360 / segments | |
segment_step = 6.28 * radius / segments | |
turtle.left(turn_step / 2) | |
for i in range(segments): | |
color_step = 2 * i / (segments - 1) | |
red = 2 - color_step | |
if red > 1: red = 1 | |
blue = color_step | |
if blue > 1: blue = 1 | |
turtle.pencolor(red, 0, blue) | |
turtle.forward(segment_step) | |
turtle.left(turn_step) | |
turtle.right(turn_step / 2) | |
turtle.speed(0) | |
turtle.pensize(50) | |
circle(150) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment