How kirilbt/bike-demo-threejs works
Project type and purpose
• This is a single‐page front‐end demonstration built with Three.js, GSAP, ASScroll, and Vite.
• Its goal is to showcase a 3D bike scene with interactive scroll and animation effects.
File structure
• Top level:
• index.html – the HTML entry point
• style.css – global styles
• main.js – bootstraps the application
• package.json / package-lock.json – dependencies and scripts
• public/ – static assets served by Vite
• Source code is under Experience/:
• Experience.js – core class that initializes renderer, scene, camera, controls, preloader, time & size utilities
• World/ – defines scene objects (Bike, Environment, Floor, World container)
• Utils/ – helper modules (Debug, Resources, Sizes, Time, asset lists)
• Static assets:
• public/draco/ – Draco decoder scripts & WASM for glTF compression
• public/models – .glb bike model
• public/textures & fonts & videos
README for additional insights
• Confirms use of Three.js for rendering, GSAP for animation, ASScroll for scroll-driven animations, Vite as bundler/dev server.
• No backend or API layer—purely client-side.
Main components
a. User’s Browser/Client
b. Static Asset Server (Vercel/Vite Dev Server)
c. Application Entry (index.html + style.css)
d. main.js & Experience Manager
e. Three.js Engine (Renderer, Scene, Camera)
f. Controls & Scroll Manager (ASScroll + OrbitControls)
g. Animation Engine (GSAP)
h. Resource Loader (Three.js GLTFLoader + DracoLoader)
i. World Components (Bike, Environment, Floor)
j. Utilities (Sizes, Time, Debug overlay)
k. Static Assets (models, textures, fonts, videos)
Relationships and interactions
• Browser → fetch index.html + CSS + main.js
• main.js instantiates Experience
• Experience sets up Renderer → Scene → Camera → Controls
• Preloader & Resources utility load assets (using Draco decoder)
• Once loaded, World module adds Bike, Environment, Floor to Scene
• ASScroll feeds scroll events into Experience → triggers GSAP animations on scene objects & camera
• Render loop (Time utility) advances frame by frame
• Debug util overlays stats if in debug mode
Architectural patterns & design principles
• Modular single‐page architecture: Experience as orchestrator, clear separation of concerns (World vs. Utils)
• Dependency injection: Resources passed into World components
• Event‐driven update loop: Time tick events drive render + animations
• Code splitting: Visitor code organized by feature rather than all in one file
Final checklist
• Components clearly labeled
• Callouts for key technologies (Three.js, GSAP, ASScroll, Draco)