# jonobr1/patatap architecture

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

- Interactive diagram: https://gitdiagram.com/jonobr1/patatap
- Repository: https://github.com/jonobr1/patatap

## Overview

Patatap lets a user trigger two-dimensional animations with sound, primarily through keyboard and touch input; the entry point also supports MIDI. The controller maps input to registered animations, which draw on the Two.js canvas and may play associated sounds. The README describes the product at a high level; sampled code confirms animation registration, palette updates and audio loading. Several animation implementations are represented by their exact files, while the broader animation catalog is grouped by its source directory. Some UI and dispatch details are not visible in the excerpts, so those links are omitted or marked unverified.

Main entry points: [`src/animations/index.js`](https://github.com/jonobr1/patatap/blob/main/src/animations/index.js) (Animation registry), [`src/animations/palette.js`](https://github.com/jonobr1/patatap/blob/main/src/animations/palette.js) (Color palettes), [`src/index.js`](https://github.com/jonobr1/patatap/blob/main/src/index.js) (Input and UI), [`src/animations/bubbles.js`](https://github.com/jonobr1/patatap/blob/main/src/animations/bubbles.js) (Bubbles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Interaction"]
  node_controller["Input and UI<br/>[index.js]"]
  node_midi["MIDI input<br/>[index.js]"]
end

subgraph group_animation["Animation system"]
  node_registry["Animation registry<br/>[index.js]"]
  node_anim_bubbles["Bubbles<br/>[bubbles.js]"]
  node_anim_clay["Clay<br/>[clay.js]"]
  node_anim_confetti["Confetti<br/>[confetti.js]"]
  node_anim_corona["Corona<br/>[corona.js]"]
  node_anim_pistons["Pistons<br/>[pistons.js]"]
  node_anim_pinwheel["Pinwheel<br/>[pinwheel.js]"]
  node_anim_catalog["Other animations"]
  node_palette["Color palettes<br/>[palette.js]"]
end

subgraph group_rendering["Rendering"]
  node_common["Canvas setup<br/>[common.js]"]
end

subgraph group_audio["Audio"]
  node_sound["Sound engine<br/>[sound.js]"]
  node_audio_files["Sound assets"]
end

node_user(("User"))

node_user -->|"provides input"| node_controller
node_user -.->|"plays MIDI"| node_midi
node_controller -->|"loads audio"| node_registry
node_controller -.->|"dispatches animation"| node_registry
node_controller -->|"attaches canvas"| node_common
node_anim_bubbles -->|"registers with"| node_registry
node_anim_clay -->|"registers with"| node_registry
node_anim_confetti -->|"registers with"| node_registry
node_anim_corona -->|"registers with"| node_registry
node_anim_pistons -->|"registers with"| node_registry
node_anim_pinwheel -->|"registers with"| node_registry
node_anim_catalog -.->|"registers with"| node_registry
node_anim_bubbles -->|"uses colors"| node_palette
node_anim_clay -->|"uses colors"| node_palette
node_anim_confetti -->|"uses colors"| node_palette
node_anim_corona -->|"uses colors"| node_palette
node_anim_pistons -->|"uses colors"| node_palette
node_anim_pinwheel -->|"uses colors"| node_palette
node_registry -->|"creates sounds"| node_sound
node_sound -.->|"loads audio"| node_audio_files

click node_controller "https://github.com/jonobr1/patatap/blob/main/src/index.js"
click node_midi "https://github.com/jonobr1/patatap/blob/main/src/index.js"
click node_registry "https://github.com/jonobr1/patatap/blob/main/src/animations/index.js"
click node_anim_bubbles "https://github.com/jonobr1/patatap/blob/main/src/animations/bubbles.js"
click node_anim_clay "https://github.com/jonobr1/patatap/blob/main/src/animations/clay.js"
click node_anim_confetti "https://github.com/jonobr1/patatap/blob/main/src/animations/confetti.js"
click node_anim_corona "https://github.com/jonobr1/patatap/blob/main/src/animations/corona.js"
click node_anim_pistons "https://github.com/jonobr1/patatap/blob/main/src/animations/pistons.js"
click node_anim_pinwheel "https://github.com/jonobr1/patatap/blob/main/src/animations/pinwheel.js"
click node_anim_catalog "https://github.com/jonobr1/patatap/tree/main/src/animations"
click node_palette "https://github.com/jonobr1/patatap/blob/main/src/animations/palette.js"
click node_common "https://github.com/jonobr1/patatap/blob/main/src/common.js"
click node_sound "https://github.com/jonobr1/patatap/blob/main/src/sound.js"
click node_audio_files "https://github.com/jonobr1/patatap/tree/main/assets"

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_controller,node_midi,node_user toneBlue
class node_registry,node_anim_bubbles,node_anim_clay,node_anim_confetti,node_anim_corona,node_anim_pistons,node_anim_pinwheel,node_anim_catalog,node_palette toneAmber
class node_common toneMint
class node_sound,node_audio_files toneRose
```

## Components

### Interaction

- [Input and UI](https://github.com/jonobr1/patatap/blob/main/src/index.js): `src/index.js`
- [MIDI input](https://github.com/jonobr1/patatap/blob/main/src/index.js): `src/index.js`

### Animation system

- [Animation registry](https://github.com/jonobr1/patatap/blob/main/src/animations/index.js): `src/animations/index.js`
- [Bubbles](https://github.com/jonobr1/patatap/blob/main/src/animations/bubbles.js): `src/animations/bubbles.js`
- [Clay](https://github.com/jonobr1/patatap/blob/main/src/animations/clay.js): `src/animations/clay.js`
- [Confetti](https://github.com/jonobr1/patatap/blob/main/src/animations/confetti.js): `src/animations/confetti.js`
- [Corona](https://github.com/jonobr1/patatap/blob/main/src/animations/corona.js): `src/animations/corona.js`
- [Pistons](https://github.com/jonobr1/patatap/blob/main/src/animations/pistons.js): `src/animations/pistons.js`
- [Pinwheel](https://github.com/jonobr1/patatap/blob/main/src/animations/pinwheel.js): `src/animations/pinwheel.js`
- [Other animations](https://github.com/jonobr1/patatap/tree/main/src/animations): `src/animations`
- [Color palettes](https://github.com/jonobr1/patatap/blob/main/src/animations/palette.js): `src/animations/palette.js`

### Rendering

- [Canvas setup](https://github.com/jonobr1/patatap/blob/main/src/common.js): `src/common.js`

### Audio

- [Sound engine](https://github.com/jonobr1/patatap/blob/main/src/sound.js): `src/sound.js`
- [Sound assets](https://github.com/jonobr1/patatap/tree/main/assets): `assets`

### Other components

- **User**

## Connections

- User → Input and UI: provides input (evidence: `src/index.js`)
- User → MIDI input: plays MIDI
- Input and UI → Animation registry: loads audio (evidence: `src/index.js`)
- Input and UI → Animation registry: dispatches animation (evidence: `src/index.js`)
- Input and UI → Canvas setup: attaches canvas (evidence: `src/index.js`)
- Bubbles → Animation registry: registers with (evidence: `src/animations/bubbles.js`)
- Clay → Animation registry: registers with (evidence: `src/animations/clay.js`)
- Confetti → Animation registry: registers with (evidence: `src/animations/confetti.js`)
- Corona → Animation registry: registers with (evidence: `src/animations/corona.js`)
- Pistons → Animation registry: registers with (evidence: `src/animations/pistons.js`)
- Pinwheel → Animation registry: registers with (evidence: `src/animations/pinwheel.js`)
- Other animations → Animation registry: registers with (evidence: `src/animations/corona.js`)
- Bubbles → Color palettes: uses colors (evidence: `src/animations/bubbles.js`)
- Clay → Color palettes: uses colors (evidence: `src/animations/clay.js`)
- Confetti → Color palettes: uses colors (evidence: `src/animations/confetti.js`)
- Corona → Color palettes: uses colors (evidence: `src/animations/corona.js`)
- Pistons → Color palettes: uses colors (evidence: `src/animations/pistons.js`)
- Pinwheel → Color palettes: uses colors (evidence: `src/animations/pinwheel.js`)
- Animation registry → Sound engine: creates sounds (evidence: `src/animations/index.js`)
- Sound engine → Sound assets: loads audio
