How wagerfield/parallax works
Parallax.js is a browser library that moves scene layers in response to device orientation/motion, falling back to cursor input. Users provide a scene and configuration; the engine selects layers, collects input, transforms it into smoothed and bounded offsets, and applies positions. The single runtime module also covers calibration, runtime setters, lifecycle control, and feature detection. README documents these capabilities, but the source excerpt omits parts of their implementation, so the graph keeps relationships at the module boundary.
Main entry points: parallax.js Parallax instance
Components 17
Parallax engine
- Parallax instance
src/parallax.js - Configuration and methods
src/parallax.js - Feature detection
src/parallax.js
Input sources
- Device orientation
- Device motion
- Cursor input
Motion processing
- Input selection
src/parallax.js - Input calibration
src/parallax.js - Motion transform
src/parallax.js - Smoothing and limits
src/parallax.js
Layer output
- Layer selection
src/parallax.js - Layer depth
src/parallax.js - Layer positioning
src/parallax.js
Other components
- Application developer
- Scene and options
- Scene layers
- Animation frame scheduler
Connections 22
- Application developer → Scene and options: configures
README.md - Application developer → Parallax instance: creates
README.md - Scene and options → Parallax instance: initializes
README.md - Parallax instance → Configuration and methods: reads settings
src/parallax.js - Parallax instance → Feature detection: checks support
src/parallax.js - Parallax instance → Layer selection: updates layers
src/parallax.js - Scene layers → Layer selection: provides elements
README.md - Parallax instance → Input selection: registers input
src/parallax.js - Device orientation → Input selection: supplies events
- Device motion → Input selection: supplies events
- Cursor input → Input selection: supplies events
src/parallax.js - Input selection → Input calibration: calibrates input
src/parallax.js - Input calibration → Motion transform: provides input
src/parallax.js - Motion transform → Smoothing and limits: computes motion
src/parallax.js - Parallax instance → Smoothing and limits: updates each frame
src/parallax.js - Smoothing and limits → Layer depth: scales by depth
src/parallax.js - Layer selection → Layer depth: provides layers
src/parallax.js - Layer depth → Layer positioning: computes offsets
src/parallax.js - Layer positioning → Scene layers: sets positions
src/parallax.js - Parallax instance → Animation frame scheduler: requests frames
src/parallax.js - Animation frame scheduler → Parallax instance: runs frame callback
- Configuration and methods → Parallax instance: updates at runtime
README.md