Developer Documentation
A cinematic, interactive demo with intelligent state transitions and compound navigation paths
| Aspect | Details |
|---|---|
| Concept | 5-state interactive journey with substates and intelligent transition routing |
| Navigation | Bottom sticky nav bar with icon-based state switching + compound transition support |
| State System | Primary states (1-5) + substates (3B) + automatic routing through intermediate states |
| Transition Logic | Direct animations where available, compound transitions via intermediate states when needed |
| Performance | Preloaded animations, graceful fallbacks, mobile-optimized with 60fps target |
const states = {
1: { title: "Breakthrough Haptic Technology", image: "state1_static.webp" },
2: { title: "Precision Engineering", image: "state2_static.webp" },
3: { title: "Force Distribution", image: "state3-static.webp", hasSubstate: true, currentSubstate: "A" },
"3B": { title: "Force Distribution", image: "state3b-static.webp", hasSubstate: true, currentSubstate: "B" },
4: { title: "Scalable Haptic Arrays", image: "state4_static.webp" },
5: { title: "Sensory Feedback", image: "state5_static.webp" }
};
const animations = {
"1-2": "state1-to-state2.webm",
"2-1": "state2-to-state1.webm",
"1-4": "state1-to-state4.webm",
"4-1": "state4-to-state1.webm",
"2-3": "state2-to-state3.webm",
"3-2": "state3-to-state2.webm",
"2-4": "state2-to-state4.webm",
"4-2": "state4-to-state2.webm",
"3-3B": "3Ato3B.webm",
"3B-3": "3Bto3A.webm"
};
The system automatically routes transitions through intermediate states when direct animations don't exist:
stateDiagram-v2
[*] --> S1 : page load
S1 --> S2 : direct animation
S1 --> S4 : direct animation
S2 --> S1 : direct animation
S2 --> S3 : direct animation
S2 --> S4 : direct animation
S3 --> S2 : direct animation
S3 --> S3B : substate toggle
S3B --> S3 : substate toggle
S3B --> S2 : via S3 (compound)
S4 --> S1 : direct animation
S4 --> S2 : direct animation
S1 --> S3 : via S2 (compound)
S3 --> S1 : via S2 (compound)
S1 --> S5 : via S2→S4 (compound)
S3 --> S4 : via S2 (compound)
S4 --> S5 : planned
S5 --> S4 : planned
| Function | Purpose | Key Features |
|---|---|---|
setupNavListeners() | Attaches click handlers to bottom nav icons | Prevents double-clicking during transitions |
transitionToState(targetState) | Master transition controller | Handles direct, compound, and substate transitions |
performCompoundTransition(from, via, to) | Routes transitions through intermediate states | Seamless multi-hop navigation with timing control |
toggleState3Substate() | Switches between 3A and 3B views | Same content, different visual perspective |
playTransitionAnimation(path, target) | Handles WebM playback and fallbacks | Error recovery, proper video/image switching |
updateActiveNav() | Manages nav bar highlighting | Special handling for substates (3B highlights nav item 3) |
preloadAnimations() | Background loads all WebM files | Prevents first-play stuttering |
sequenceDiagram
participant UI as Nav Click
participant TM as transitionToState()
participant CT as performCompoundTransition()
participant V1 as Video 1→2
participant V2 as Video 2→3
participant IMG as Final Image
UI->>TM: click state 3 (from state 1)
TM->>TM: check: no direct "1-3" animation
TM->>CT: route via state 2
CT->>V1: play "1-2.webm"
V1-->>CT: ended
Note over CT: 100ms pause
CT->>V2: play "2-3.webm"
V2-->>CT: ended
CT->>IMG: load state 3 image
CT-->>TM: compound transition complete
TM->>TM: update content & nav
When in state 3 or 3B, a "Switch" button appears that toggles between the two perspectives using dedicated transition animations.
assets/animations/state-static/stateN_static.webpstates object with new entryanimations objecthasSubstate: true and currentSubstate to parent stateanimations objectIf direct animation doesn't exist, the system will automatically route through the most logical intermediate state (usually state 2). To add custom routing:
// In performCompoundTransition(), add custom routing logic
if (currentState === 4 && targetState === 3) {
await performCompoundTransition(currentState, 2, targetState);
}
| Issue | Cause | Solution |
|---|---|---|
| White flash during transition | Image not preloaded | Check image paths, ensure preloading completes |
| Stuck in transitioning state | Error in animation playback | Check browser console, verify WebM format |
| Nav not highlighting correctly | Substate logic issue | Check updateActiveNav() special cases |
| Compound transition breaks | Missing intermediate animation | Add fallback or create missing WebM file |
The system logs transition paths:
// Normal direct transition
"Playing direct transition: 1 → 2"
// Compound transition
"Using compound transition: 1 → 2 → 3"
"First leg complete: 1 → 2"
"Second leg complete: 2 → 3"
// Substate toggle
"Toggling state 3 substate: A → B"
| Component | Specification |
|---|---|
| Video Format | WebM (VP9 codec, 25fps, 1920×1080) |
| Image Format | WebP (optimized for quality/size balance) |
| Transition Duration | 1 second per animation |
| Browser Support | Chrome 88+, Firefox 85+, Safari 14+ |
| Mobile Support | iOS 14+, Android 8+ |
| Dependencies | None (vanilla JavaScript) |
For implementation questions or feature requests, contact the development team or open an issue in the repository.