How yogender-ai/fun-particle-feedback works
Purpose
Quantum Flux is documented as a browser-based interactive particle-art experience: webcam hand gestures and optional audio drive a high-particle-count gravity simulation and WebGL visuals. The deployed target is Cloudflare Pages at particle-gravity-fun.pages.dev.
Repository Reality and Entry Points
The supplied tree contains only README.md; no executable source, package manifest, Rust crate, assets, or Cloudflare configuration are present to validate the documented build or runtime entry points. README.md documents intended commands (wasm-pack build, npm run dev) and identifies a planned JavaScript entry point, but that path is absent from the supplied repository view.
Grounding: README.md.
Browser Input and Interaction Stage
The documented client flow begins with webcam capture, passed to MediaPipe Hands. The AI layer produces 21 landmarks per hand; gesture recognition maps landmarks to particle modes and effects such as swarm, supernova, beam/fire, and battle. Webcam permission and MediaPipe model execution are key browser/external-service boundaries.
Documented intended paths: src/tracking/mediapipe.js, src/tracking/gestures.js (not present in supplied tree).
Physics / WASM Core
A Rust core compiled to WebAssembly is intended to own particle state and per-frame simulation. Its stated stages are spatial-hash neighbor lookup, N-body gravity force calculation, and Verlet integration. Hand landmark coordinates enter this boundary as gravity-well/control inputs; updated particle positions leave it for rendering. This is the primary performance boundary behind the claimed 8,192-particle target.
Documented intended paths: src-rust/lib.rs, src-rust/physics/solver.rs, src-rust/physics/verlet.rs (not present).
Particle Modes and Morphing
The physics layer is documented to support shape/mode initialization or targets, including heart, Saturn, flower, fireworks, battle, survival, and audio-reactive behavior. Morph implementations are conceptually separate from the generic particle lifecycle and solver.
Documented intended paths: src-rust/particle.rs, src-rust/morphs/heart.rs, src-rust/morphs/saturn.rs (not present).
Rendering and Audio Pipeline
Three.js is intended to create the scene and consume particle positions from WASM. Custom WebGL vertex and fragment shaders draw particle geometry, glow, and color. An FFT audio analyzer can feed music features into particle behavior. The frame loop coordinates tracking updates, simulation, and GPU rendering.
Documented intended paths: src/main.js, src/scene.js, src/shaders/particle.vert (not present).
UI, Deployment, and External Dependencies
A browser HUD and controls layer is documented to expose mode selection and runtime stats. Material runtimes/services are JavaScript in the browser, Rust/WASM, Three.js/WebGL 2.0, MediaPipe Hands, browser webcam/audio APIs, and Cloudflare Pages hosting. The documented Cloudflare configuration file is absent from the supplied tree.
Documented intended paths: src/ui/hud.js, src/ui/controls.js, wrangler.toml (not present).
Main entry points: README.md Documented architecture
Components 15
Browser Runtime
- Frame loop · Coordinates tracking, simulation, and rendering each frame.
- Webcam and audio APIs · Permission-gated camera capture and optional audio input.
- MediaPipe Hands · Produces 21 landmarks per hand from webcam frames.
- Gesture mapping · Maps landmarks to modes and effects.
- FFT analyzer · Extracts music features for audio-reactive behavior.
- HUD and controls · Exposes mode selection and runtime statistics.
- Three.js scene · Consumes WASM positions and submits particle rendering.
- Particle shaders · Draws particle geometry, glow, and color.
Rust / WASM Core
- WASM simulation boundary · Owns particle state and exchanges controls and positions with JavaScript.
- Particle modes and morphs · Initializes or targets heart, Saturn, battle, survival, and other modes.
- Spatial-hash lookup · Finds neighboring particles efficiently.
- N-body gravity · Calculates particle forces and hand gravity wells.
- Verlet integration · Updates particle positions per frame.
Other components
- Documented architecture · The only supplied repository file; all runtime components are documented, not present.
README.md - Cloudflare Pages · Intended deployed host; configuration is absent.
Connections 20
- Documented architecture → Frame loop: documents
- Documented architecture → WASM simulation boundary: documents
- Documented architecture → Cloudflare Pages: documents deployment
- Cloudflare Pages → Frame loop: serves
- Webcam and audio APIs → MediaPipe Hands: camera frames
- MediaPipe Hands → Gesture mapping: hand landmarks
- Gesture mapping → WASM simulation boundary: mode and hand controls
- Webcam and audio APIs → FFT analyzer: audio stream
- FFT analyzer → WASM simulation boundary: music features
- HUD and controls → Frame loop: user selections
- Frame loop → MediaPipe Hands: updates
- Frame loop → WASM simulation boundary: steps simulation
- WASM simulation boundary → Particle modes and morphs: selects targets
- WASM simulation boundary → Spatial-hash lookup: particle state
- Spatial-hash lookup → N-body gravity: neighbors
- N-body gravity → Verlet integration: forces
- Verlet integration → WASM simulation boundary: updated positions
- WASM simulation boundary → Three.js scene: particle positions
- Frame loop → Three.js scene: renders frame
- Three.js scene → Particle shaders: draw calls