from random import random, seed;

import math

seed(7) # this makes the random sequence the same every time
        
Rectangle(color=['#000011', '#000044']) # background color gradient

rocket = Rectangle(x=50, y=110, width=0.4, height=10, color=['#fc6', '#000'])
with animation(duration=0.4):
    rocket.y = 60
with animation(duration=0.2):
    rocket.y = 35
    rocket.height = 0
    rocket.color = 'black'
with animation(duration=0.1):
    pass

sparkles = []
for i in range(50):
    rect = Rectangle(x=50, y=30, width=0.6, height=1.0, color=['#fdc', '#fda'])
    sparkles.append(rect)
with animation(duration=0.2):
    for rect in sparkles:
        angle = 2 * math.pi * random()
        speed = 20 * math.sqrt(random())
        rect.x += speed * math.cos(angle)
        rect.y += speed * math.sin(angle)
        rect.color = ['#000', '#2c4', '#3f5']
with animation(duration=1):
    for rect in sparkles:
        upward = rect.y - 30
        rect.y += 3 + 0.1 * upward
        rect.color='black'
        rect.width = 0
        rect.height = 0
with animation(duration=0.5):
    pass

Fireworks (well, just the one)

by snild

Created 3 months, 3 weeks ago.