You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
560 B
Python

3 years ago
#!/usr/bin/env python3
import random
3 years ago
import math
3 years ago
def circle(ctx,x,y,r):
3 years ago
ctx.arc(x,y,r,0,math.pi*2.)
3 years ago
ctx.stroke()
3 years ago
def circle_fill(ctx,x,y,r):
ctx.arc(x,y,r,0,math.pi*2.)
ctx.fill()
3 years ago
3 years ago
def draw_crater(ctx,x,y,r):
for n in range(3):
off_x = random.uniform(-0.01, 0.01)
off_y = random.uniform(-0.01, 0.01)
ctx.arc(x + off_x, y + off_y, r, 0, math.pi*2.)
ctx.fill()
3 years ago
3 years ago
def random_color():
red = random.uniform(0, 1)
green = random.uniform(0, 1)
blue = random.uniform(0, 1)
return red, green, blue