Celebration Animation Generator
Overview
The Celebration Animation Generator skill creates self-contained p5.js celebration animations for educational MicroSims. These animations provide visual feedback and rewards when students complete tasks correctly, enhancing engagement and motivation in interactive learning environments.
Each animation is a single JavaScript file that can be copied into any MicroSim folder to provide visual celebration feedback. The animations are designed to work with the p5.js library and follow a consistent API pattern.
When to Use This Skill
Use this skill when you need to create:
- Particle effects for student rewards and achievements
- Celebration animations (confetti, fireworks, sparkles)
- Visual feedback for correct answers in educational games
- Motion-based animations (floating, bursting, falling objects)
- Custom themed celebrations (baseballs, butterflies, stars, hearts)
Key Features
- Self-contained modules: Each animation is a single JavaScript file
- Consistent API: Four standard functions for all animations
- Speed control: Adjustable animation speed (slow, medium, fast)
- Rainbow color palette: Built-in colorful defaults
- Multiple motion patterns: Burst, float, fall, explode, zoom, bounce
- p5.js integration: Works seamlessly with p5.js MicroSims
Animation API Pattern
All celebration animations follow this consistent API:
1 2 3 4 5 6 7 8 9 10 11 | |
Speed Multiplier Values
| Value | Description | Use Case |
|---|---|---|
| 0.5 | Slow | Younger students, accessibility |
| 1.0 | Medium | Default speed |
| 1.8 | Fast | Quick feedback, older students |
Available 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
All animations use the rainbow color palette for visual variety:
1 2 3 4 5 6 7 8 9 | |
Common Particle Properties
Each particle in an animation typically has these properties:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Workflow
Step 1: Parse the Animation Request
Extract from the user's description:
- Object/Shape: What is being animated (baseballs, hearts, butterflies)
- Motion Pattern: How it moves (exploding, floating, falling, zooming)
- Origin Point: Where it starts (bottom center, top, sides, center)
- Suggested Name: Derive a kebab-case filename (e.g.,
baseball-explosion.js)
Step 2: Generate the Animation File
Create a new JavaScript file following requirements:
- Use a unique particle array name (e.g.,
baseballExplosionParticles) - Use a unique suffix for helper functions to avoid conflicts
- Include all four standard API functions
- Support
speedMultiplierparameter - Use the standard rainbow color palette
Step 3: Test with Animation Library Tester
Integrate with the animation-lib-tester MicroSim:
- Add script import to main.html
- Add animation to the
animationTypesarray - Add draw and clear function calls
- Add trigger case in switch statement
Step 4: Update Documentation
Add the new animation to the README:
- Add row to "Available Animations" table
- Add API documentation with function signatures
File Naming Convention
- Filename: kebab-case (
baseball-explosion.js) - Function names: PascalCase (
createBaseballExplosion()) - Particle array: camelCase (
baseballExplosionParticles) - Helper functions: Add unique suffix (
drawBaseballBE())
Example: Creating "Baseball Explosion"
For request: "Baseballs exploding from the bottom middle of the screen"
- Filename:
baseball-explosion.js - Motion: Burst Up pattern (like Book Burst)
- Object: Baseball with red stitching
- Functions:
createBaseballExplosion(centerX, startY, speedMultiplier)updateAndDrawBaseballExplosion()isBaseballExplosionActive()clearBaseballExplosion()
Integration with MicroSims
To use a celebration animation in your MicroSim:
1 2 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Educational Benefits
Celebration animations support learning by:
- Positive reinforcement: Immediate visual reward for correct answers
- Engagement: Colorful effects maintain student interest
- Motivation: Celebrations encourage continued participation
- Dopamine response: Visual rewards trigger positive associations
- Accessibility: Speed control accommodates different needs
Technical Details
- Library: p5.js (loaded via CDN)
- File Location:
/docs/sims/shared/animations/ - Testing Tool:
/docs/sims/animation-lib-tester/ - Particle Count: Typically 20-50 particles per animation
- Duration: Most animations complete in 2-4 seconds
- Performance: Optimized for smooth 60fps rendering
Best Practices
- Keep particle counts reasonable (20-50) for performance
- Use fade rates so animations end naturally
- Provide clear API documentation for each animation
- Test at different speeds to ensure good experience
- Match animation theme to educational content when possible
- Ensure animations don't obscure important UI elements
Related Skills
- MicroSim P5 Generator - For creating the base MicroSim
- MicroSim Standardization - For quality validation
- MicroSim Screen Capture - For capturing animation screenshots
References
- p5.js Reference
- Particle Systems Tutorial
- Animation Library Tester:
/docs/sims/animation-lib-tester/ - Shared Animations:
/docs/sims/shared/animations/