def star(cx, cy, r):
points = []
for i in range(10):
a = i * pi / 5 - pi / 2
rr = r if i % 2 == 0 else r * 0.45
points.append((cx + rr * cos(a), cy + rr * sin(a)))
return points
def spiral(t, turns=6.5):
y = t * height - height / 2
r = radius * (1 - t) + 0.25
a = t * turns * 2 * pi
return (r * cos(a), y, r * sin(a))
def glitter(n):
for _ in range(n):
t = random() ** 0.85
yield cone_point(t, jitter=0.35)
def ornaments():
for kind in ("silver", "red", "gold", "bell"):
hang(kind, on=tree.surface)
def snowflake(x, y, size):
for k in range(6):
branch(x, y, size, angle=k * pi / 3)
def merry_christmas():
draw(spiral, by=shooting_star)
light(star(0, height, 1.5))
write("Merry Christmas", font="script")