home / skills / dmccreary / claude-skills / celebration-animation-generator

celebration-animation-generator skill

/skills/archived/celebration-animation-generator

This skill generates self-contained p5.js celebration animations for MicroSims, enabling quick creation, testing, and integration of reward visuals.

npx playbooks add skill dmccreary/claude-skills --skill celebration-animation-generator

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
5.2 KB
---
name: celebration-animation-generator
description: This skill generates self-contained p5.js celebration animations for educational MicroSims. Use this skill when users request creating new celebration animations, particle effects, reward animations, or visual feedback for student achievements. The skill creates a new animation JavaScript file in /docs/sims/shared/animations/ and integrates it with the animation-lib-tester MicroSim for testing.
---

# Celebration Animation Generator

## Overview

This skill generates self-contained p5.js celebration animation modules for the reading-for-kindergarten intelligent textbook project. Each animation is a single JavaScript file that can be copied into any MicroSim folder to provide visual celebration feedback when students complete tasks correctly.

## When to Use This Skill

Use this skill when users request:
- Creating a new celebration animation (e.g., "baseballs exploding", "butterflies flying")
- Adding particle effects for student rewards
- Generating visual feedback animations for educational games
- Expanding the celebration animation library

## Workflow

### Step 1: Parse the Animation Request

Extract from the user's description:
1. **Object/Shape**: What is being animated (baseballs, hearts, butterflies, etc.)
2. **Motion Pattern**: How it moves (exploding, floating, falling, zooming, etc.)
3. **Origin Point**: Where it starts (bottom center, top, sides, center, etc.)
4. **Suggested Name**: Derive a kebab-case filename (e.g., "baseball-explosion.js")

### Step 2: Generate the Animation File

Create a new JavaScript file in `/docs/sims/shared/animations/` following the template pattern in `references/animation-template.md`.

Key requirements:
- Use a **unique particle array name** (e.g., `baseballExplosionParticles`)
- Use a **unique suffix for helper functions** to avoid conflicts (e.g., `drawBaseballBE()`)
- Include all four standard API functions:
  - `create[Name](params, speedMultiplier)` - Initialize particles
  - `updateAndDraw[Name]()` - Physics and rendering
  - `is[Name]Active()` - Check if animation is playing
  - `clear[Name]()` - Stop animation immediately
- Support `speedMultiplier` parameter (0.5=slow, 1.0=medium, 1.8=fast)
- Use the standard rainbow color palette for variety

### Step 3: Update the Animation Library Tester

After creating the animation file, update `/docs/sims/animation-lib-tester/` to include the new animation:

1. **main.html**: Add a new `<script>` import for the animation file
2. **animation-lib-tester.js**:
   - Add the animation name to the `animationTypes` array
   - Add `updateAndDraw[Name]()` call in the `draw()` function
   - Add `clear[Name]()` call in the `triggerCelebration()` function
   - Add a new case in the switch statement to trigger the animation

### Step 4: Update the README

Add the new animation to `/docs/sims/shared/animations/README.md`:
- Add row to the "Available Animations" table
- Add API documentation section with function signature and description

## Animation Patterns Reference

### Motion Patterns

| Pattern | Description | Example Use |
|---------|-------------|-------------|
| Burst Up | Objects shoot upward from a point with gravity | Book Burst, Alphabet Fireworks |
| Float Up | Objects gently float upward | Yellow Stars, Balloons |
| Fall Down | Objects fall from top | Happy Star Sprinkle, Confetti, Spark Shower |
| Explode Out | Objects radiate outward from center | Rainbow Sparkle Burst, Magic Book Bloom |
| Zoom Across | Objects move horizontally | Reading Rocket Zoom |
| Pop/Bounce | Objects appear, bounce, then pop | Giggle Glitter Pop |

### Standard Color Palette

```javascript
const rainbowColors = [
  '#FF6B6B', // red
  '#FF8E53', // orange
  '#FFD93D', // yellow
  '#6BCB77', // green
  '#4D96FF', // blue
  '#9B59B6', // purple
  '#FF6B9D'  // pink
];
```

### Common Particle Properties

```javascript
{
  x, y,           // Position
  vx, vy,         // Velocity
  size,           // Size/radius
  alpha,          // Transparency (0-255)
  fadeRate,       // How fast alpha decreases
  rotation,       // Current angle
  rotationSpeed,  // Angular velocity
  color,          // p5.js color object
  gravity,        // Downward acceleration (for burst patterns)
  wobble,         // Oscillation factor (for floating patterns)
  trail: []       // Array of past positions (for trail effects)
}
```

## File Naming Convention

- Use kebab-case for filename: `baseball-explosion.js`
- Use PascalCase for function names: `createBaseballExplosion()`
- Use camelCase for particle array: `baseballExplosionParticles`
- Add unique suffix to helper functions: `drawBaseballBE()`

## Example: Creating "Baseball Explosion"

For request: "Baseballs exploding from the bottom middle of the screen"

1. **Filename**: `baseball-explosion.js`
2. **Motion**: Burst Up pattern (like Book Burst)
3. **Object**: Baseball with red stitching
4. **Functions**:
   - `createBaseballExplosion(centerX, startY, speedMultiplier)`
   - `updateAndDrawBaseballExplosion()`
   - `isBaseballExplosionActive()`
   - `clearBaseballExplosion()`

## Resources

### references/animation-template.md
Contains the complete template for a new animation file with all required functions and documentation structure.

Overview

This skill generates self-contained p5.js celebration animation modules tailored for MicroSims in an educational textbook project. It creates a single JavaScript animation file placed in /docs/sims/shared/animations/ and wires the animation into the animation-lib-tester for quick verification. The output follows naming, API, and color/pattern conventions to avoid conflicts and ensure consistency.

How this skill works

Given a short user description, the skill extracts the animated object, motion pattern, origin point, and a suggested filename. It emits a JavaScript file that implements four standard API functions (create, updateAndDraw, isActive, clear), uses a unique particle array and helper suffixes, and supports a speedMultiplier parameter. Finally, it updates the animation-lib-tester (HTML import and test JS) and appends documentation to the animations README.

When to use it

  • Requesting a new celebration animation (e.g., "butterflies floating up")
  • Adding particle effects or reward animations for student achievements
  • Creating visual feedback for correct answers or level completion
  • Expanding or standardizing the shared animation library
  • Testing new animation ideas quickly via the animation-lib-tester

Best practices

  • Provide a concise description containing object, motion, and origin (e.g., "hearts floating from bottom-left").
  • Use kebab-case for filenames and PascalCase for exported function roots to match conventions.
  • Pick unique particle array and helper suffix names to avoid namespace collisions.
  • Support speedMultiplier (0.5, 1.0, 1.8) and use the standard rainbow color palette for variety.
  • Follow one of the referenced motion patterns (Burst Up, Float Up, Explode Out, etc.) for predictable physics.

Example use cases

  • Create a "baseball-explosion.js" file that bursts baseballs upward from the bottom-center when a mini-game is solved.
  • Generate a "butterfly-float.js" animation where butterflies gently float up when a reading milestone is reached.
  • Add a "confetti-spray.js" file that radiates rainbow confetti from the current word location as instant feedback.
  • Implement a "rocket-zoom.js" horizontal zoom animation for timed challenge completion.
  • Produce a "star-fall.js" animation with falling stars for end-of-lesson celebrations.

FAQ

How does naming avoid conflicts with other animations?

The skill enforces kebab-case filenames, unique camelCase particle arrays, and unique helper-function suffixes so new files won’t collide with existing code.

Can I control animation speed?

Yes. Every generated create function accepts speedMultiplier (0.5 = slow, 1.0 = medium, 1.8 = fast) and particle physics scale accordingly.