How manidhar8008/mw-ai-cinematic works
Purpose and Runtime
MW.AI is a static, scroll-driven cinematic landing page. React 18 and TypeScript run in a Vite-built browser application; visuals use native HTML5 2D Canvas and requestAnimationFrame, with no backend or animation service. Production output is static dist/, suitable for GitHub Pages or another static host.
Entry points: index.html, src/main.tsx, and src/app/App.tsx.
Application Shell
src/main.tsx mounts the React application. src/app/App.tsx composes the page-level experience, while src/app/LandingPage.tsx owns the fullscreen landing layout and scrollable document structure. The design uses a tall scroll region as input and a fixed viewport scene as output, rather than conventional routed screens.
Relevant paths:
• src/main.tsx
• src/app/App.tsx
• src/app/LandingPage.tsx
Timeline as the Core Contract
The central boundary is a pure timeline state model. Scroll progress is normalized to 0–1, then converted into visual parameters such as camera distance, subject scale, atmospheric/digital/logo opacity, wind, and turbulence. Canvas layers consume this shared state independently, keeping progression logic separate from drawing logic.
Relevant paths:
• src/app/components/CinematicScene/timeline.ts
• src/app/components/CinematicScene/useTimeline.ts
• src/app/components/CinematicScene/index.tsx
Scroll and Animation Control Flow
Browser scroll drives useTimeline, which reads window.scrollY, normalizes it against the intended scroll range, and updates timeline state. The fixed scene receives that state; individual renderers maintain canvas sizing and animation loops via browser resize events and requestAnimationFrame. This makes scroll position the authoritative experience controller, while time-based rendering supplies motion.
Flow: scroll position → useTimeline → timeline state → layered renderers.
Layered Cinematic Scene
CinematicScene is the orchestration point for the visual stack. It combines three canvas-based renderers and a DOM logo layer, allowing each effect system to fade or transform based on the same timeline values.
Relevant paths:
• src/app/components/CinematicScene/index.tsx
• src/app/components/CinematicScene/renderers/AtmosphereCanvas.tsx
• src/app/components/CinematicScene/renderers/SkydiverCanvas.tsx
Visual Transformation Stages
The timeline defines four phases: exit, fall, transform, and arrival. Atmosphere rendering handles sky, clouds, storms, lightning, and wind; the skydiver renderer handles the animated subject and turbulence; digital rendering introduces abstract grid, particle, and data effects during transformation. The final logo is DOM-rendered for text styling and reveal effects.
Relevant paths:
• src/app/components/CinematicScene/renderers/AtmosphereCanvas.tsx
• src/app/components/CinematicScene/renderers/DigitalCanvas.tsx
• src/app/components/CinematicScene/renderers/MWLogo.tsx
Styling, Analytics, and Delivery
Global visual behavior—including fullscreen layout, hidden scrollbar, responsive typography, fonts, and cookie styling—is distributed under src/styles/. src/app/Analytics.tsx is the integration boundary for client-side analytics. Static legal, SEO, and deployment-host artifacts live in public/; CI deployment is defined in .github/workflows/deploy.yml.
Relevant paths:
• src/styles/index.css
• src/app/Analytics.tsx
• .github/workflows/deploy.yml
Main entry points: timeline.ts Timeline model · index.tsx Cinematic scene · LandingPage.tsx Landing layout · App.tsx App shell
Components 15
Browser Application
- HTML entry
index.html - React mount
src/main.tsx - App shell
src/app/App.tsx - Landing layout · Provides the tall scroll input and fixed viewport layout.
src/app/LandingPage.tsx - Global styles · Defines fullscreen, responsive, font, scrollbar, and cookie presentation.
src/styles/index.css - Analytics boundary
src/app/Analytics.tsx
Cinematic Scene
- Timeline model · Maps normalized progress to shared visual parameters and phases.
src/app/components/CinematicScene/timeline.ts - Scroll timeline hook · Normalizes browser scroll position into timeline state.
src/app/components/CinematicScene/useTimeline.ts - Cinematic scene · Composes the fixed layered visual stack.
src/app/components/CinematicScene/index.tsx - Atmosphere canvas · Draws sky, clouds, storms, lightning, and wind.
src/app/components/CinematicScene/renderers/AtmosphereCanvas.tsx - Skydiver canvas · Draws the animated subject and turbulence.
src/app/components/CinematicScene/renderers/SkydiverCanvas.tsx - Digital canvas · Draws transformation grid, particles, and data effects.
src/app/components/CinematicScene/renderers/DigitalCanvas.tsx - MW logo · Reveals styled final branding from timeline state.
src/app/components/CinematicScene/renderers/MWLogo.tsx
Delivery
- Static deployment · Builds and deploys the static production output.
.github/workflows/deploy.yml - Static dist output · Static files suitable for GitHub Pages or another static host.
Connections 18
- HTML entry → React mount: loads
- React mount → App shell: mounts
- App shell → Landing layout: composes
- App shell → Analytics boundary: integrates
- Landing layout → Scroll timeline hook: scroll input
- Scroll timeline hook → Timeline model: normalizes scroll to
- Timeline model → Cinematic scene: shared state
- Landing layout → Cinematic scene: hosts fixed scene
- Cinematic scene → Atmosphere canvas: layers
- Cinematic scene → Skydiver canvas: layers
- Cinematic scene → Digital canvas: layers
- Cinematic scene → MW logo: layers
- Timeline model → Atmosphere canvas: visual parameters
- Timeline model → Skydiver canvas: visual parameters
- Timeline model → Digital canvas: visual parameters
- Timeline model → MW logo: reveal state
- Global styles → Landing layout: styles
- Static deployment → Static dist output: builds and publishes