from math import cos, exp, pi, sin

# Gather a small light from the dark.
def ember(speed, angle, age):
    reach = 1 - exp(-1.6 * age)
    x = speed * cos(angle) * reach
    y = speed * sin(angle) * reach
    return x, y + 0.14 * age ** 2

def bloom(distance, radius):
    falloff = distance / radius
    return exp(-falloff ** 2)

def starlight(angle, time):
    pulse = 0.86 + 0.14 * cos(time)
    rays = abs(cos(4 * angle))
    return pulse * rays ** 12

def garland(height, time):
    turn = 10 * pi * height
    phase = turn + time * 0.25
    radius = 1 - height
    return radius * cos(phase), height

def snowflake(index, time, height):
    drift = sin(index + time * 0.18)
    fall = (index + time * 0.03) % 1
    return drift, height * fall

def shimmer(seed, time):
    wave = 0.5 + 0.5 * sin(seed + time)
    return 0.2 + 0.8 * wave ** 6

def ripple(angle, time):
    return 1 + 0.02 * sin(3 * angle - time)

# A quieter sky for the winter lights.
from math import cos, exp, pi, sin

# Gather a small light from the dark.
def ember(speed, angle, age):
    reach = 1 - exp(-1.6 * age)
    x = speed * cos(angle) * reach
    y = speed * sin(angle) * reach
    return x, y + 0.14 * age ** 2

def bloom(distance, radius):
    falloff = distance / radius
    return exp(-falloff ** 2)

def starlight(angle, time):
    pulse = 0.86 + 0.14 * cos(time)
    rays = abs(cos(4 * angle))
    return pulse * rays ** 12

def garland(height, time):
    turn = 10 * pi * height
    phase = turn + time * 0.25
    radius = 1 - height
    return radius * cos(phase), height

def snowflake(index, time, height):
    drift = sin(index + time * 0.18)
    fall = (index + time * 0.03) % 1
    return drift, height * fall

def shimmer(seed, time):
    wave = 0.5 + 0.5 * sin(seed + time)
    return 0.2 + 0.8 * wave ** 6

def ripple(angle, time):
    return 1 + 0.02 * sin(3 * angle - time)

# A quieter sky for the winter lights.