Fireworks: Cloning Your Recursion

Objective

After completing this lesson, you will be able to programmatically run parts of your code in parallel while combining the concepts from the previous two lessons to a splendid firework.

Content

Video summary:

The video shows how to combine recursion and animations in Snap! to build fireworks: animate a rocket upward with an easing function using blocks from the animation library, implement an explode (level) recursive block that spawns branching explosions, use clones and parallel threads so particles fly concurrently, and add randomness and costumes for lively visual effects.

Key points:

  • Use animation (glide-by-distance, easing) to make motion visible and realistic (accelerate/decelerate for gravity-like effects).
  • Implement explode (level) recursively: propel, then branch by calling explode(level-1) for each direction with a base-case to stop.
  • Spawn visual particles with clones (tell/create-clone), run explosions in parallel with launch, and delete clones when finished.
  • Add randomness (branch count, durations, sizes) and custom costumes to vary look and timing for richer fireworks.