# catdad/canvas-confetti architecture

> Architecture diagram of the GitHub repository catdad/canvas-confetti, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/catdad/canvas-confetti
- Repository: https://github.com/catdad/canvas-confetti

## Overview

canvas-confetti is a browser-side particle animation library. A page or application calls its confetti API with launch and rendering options; the runtime creates particles, animates them on a canvas, and returns a promise when the animation completes. The README also documents reduced-motion handling and custom path- or text-based shapes. The source excerpt is partial, so internal links are limited to relationships visible in the excerpts or explicitly documented in the README.

Main entry points: [`src/confetti.js`](https://github.com/catdad/canvas-confetti/blob/master/src/confetti.js) (Confetti API)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_page(("Web Page"))
node_api["Confetti API<br/>[confetti.js]"]
node_particles["Particle Setup<br/>[confetti.js]"]
node_canvas["Canvas Animation<br/>[confetti.js]"]
node_worker["Worker Rendering<br/>[confetti.js]"]
node_custom["Custom Shapes<br/>[confetti.js]"]

node_page -->|"calls"| node_api
node_api -->|"creates particles"| node_particles
node_api -->|"starts animation"| node_canvas
node_api -->|"dispatches when available"| node_worker
node_canvas -->|"updates and renders"| node_particles
node_page -->|"configures shapes"| node_custom

click node_api "https://github.com/catdad/canvas-confetti/blob/master/src/confetti.js"
click node_particles "https://github.com/catdad/canvas-confetti/blob/master/src/confetti.js"
click node_canvas "https://github.com/catdad/canvas-confetti/blob/master/src/confetti.js"
click node_worker "https://github.com/catdad/canvas-confetti/blob/master/src/confetti.js"
click node_custom "https://github.com/catdad/canvas-confetti/blob/master/src/confetti.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_page toneIndigo
class node_api toneMint
class node_particles,node_canvas,node_custom toneTeal
class node_worker toneRose
```

## Components

### Other components

- **Web Page**
- [Confetti API](https://github.com/catdad/canvas-confetti/blob/master/src/confetti.js): `src/confetti.js`
- [Particle Setup](https://github.com/catdad/canvas-confetti/blob/master/src/confetti.js): `src/confetti.js`
- [Canvas Animation](https://github.com/catdad/canvas-confetti/blob/master/src/confetti.js): `src/confetti.js`
- [Worker Rendering](https://github.com/catdad/canvas-confetti/blob/master/src/confetti.js): `src/confetti.js`
- [Custom Shapes](https://github.com/catdad/canvas-confetti/blob/master/src/confetti.js): `src/confetti.js`

## Connections

- Web Page → Confetti API: calls (evidence: `README.md`)
- Confetti API → Particle Setup: creates particles (evidence: `src/confetti.js`)
- Confetti API → Canvas Animation: starts animation (evidence: `src/confetti.js`)
- Confetti API → Worker Rendering: dispatches when available (evidence: `src/confetti.js`)
- Canvas Animation → Particle Setup: updates and renders (evidence: `src/confetti.js`)
- Web Page → Custom Shapes: configures shapes (evidence: `README.md`)
