Skip to content

Commit 1b81112

Browse files
committed
docs: update README with project features and live preview video
1 parent df49f3a commit 1b81112

2 files changed

Lines changed: 66 additions & 102 deletions

File tree

README.md

Lines changed: 66 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,145 +1,109 @@
11
# 🚗 Three.js 3D Car Viewer
22

3-
An interactive 3D car model viewer built with Three.js. This project demonstrates loading and manipulating 3D GLTF models in a web browser with keyboard controls, orbit camera, and fullscreen support.
3+
An interactive, high-end 3D car model viewer built with **Three.js** and **GSAP (GreenSock Animation Platform)**. It showcases a 3D model (GLB format) with automatic multi-angle cinematic camera paths, provides manual control capabilities, and opens with a premium loading screen transition.
44

5-
![Three.js](https://img.shields.io/badge/Three.js-black?style=for-the-badge&logo=three.js&logoColor=white)
6-
![Vite](https://img.shields.io/badge/Vite-646CFF?style=for-the-badge&logo=vite&logoColor=white)
7-
![JavaScript](https://img.shields.io/badge/JavaScript-F7DF1E?style=for-the-badge&logo=javascript&logoColor=black)
5+
![Cinematic Loading and Entrance Transition](./media/preview.webp)
6+
7+
---
88

99
## ✨ Features
1010

11-
- **3D Model Loading** - Load and display GLTF/GLB 3D models
12-
- **Orbit Controls** - Rotate, pan, and zoom around the model with mouse
13-
- **Keyboard Controls** - Move and rotate the 3D model using keyboard
14-
- **Auto-Rotation** - Smooth automatic rotation of the camera view
15-
- **Fullscreen Mode** - Double-click to toggle fullscreen
16-
- **Responsive Design** - Automatically adapts to window resizing
17-
- **Damping Effect** - Smooth camera movement with damping
11+
- **GSAP Loading Screen** - Minimalist brand layout featuring a thin horizontal loader line ("web line") that expands horizontally and a monospaced percentage counter counting up to 100% dynamically.
12+
- **Wipe-Down Reveal Transition** - Symmetrical slide-down curtain reveal that wipes the preloader away while fading/sliding loading elements up.
13+
- **Cinematic Entrance Sweep** - A majestic, smooth camera sweep that zooms in from a distance to establish the 3D scene in sync with the slide-down reveal.
14+
- **Multi-Angle Automated Paths** - Seamlessly loops through 4 cinematic camera tracks (Grand Reveal, Low Prowl, Rear Drama, Orbital Glide) with built-in camera drift simulating a handheld operator.
15+
- **Manual Orbit Controls** - Toggle to manual view with **Spacebar** to zoom, rotate, and pan around the model using OrbitControls.
16+
- **Seamless Re-Entry Blending** - When toggling back to Cinematic Mode, GSAP smoothly blends the camera position and focal target from the manual viewpoint back onto the cinematic track coordinates.
17+
- **Lighting Rig & Dynamic Underglow** - Warm key light casting shadow maps, cool fill, back-rim backlight, and an animated colored underglow spot under the model.
18+
- **Responsive Layout** - Automatically adapts camera aspect ratio and renderer frames to window resizing events.
19+
- **Automated CI/CD Deploy** - Configured with GitHub Actions to compile Vite production bundles and deploy to GitHub Pages on every push to the `main` branch.
1820

19-
## 🎮 Controls
21+
---
2022

21-
### Mouse Controls
23+
## 🎮 Controls
2224

23-
| Action | Control |
24-
| ----------- | ------------------ |
25-
| Rotate view | Left-click + drag |
26-
| Pan view | Right-click + drag |
27-
| Zoom | Mouse wheel |
25+
### Mouse Controls (Free Camera Mode)
26+
- **Rotate view** - Left-click + drag
27+
- **Pan view** - Right-click + drag
28+
- **Zoom** - Mouse wheel
2829

2930
### Keyboard Controls
31+
- **Spacebar** - Toggle between automated Cinematic Mode and manual Free Camera Mode.
32+
- **1, 2, 3, 4** - Seamlessly transition to a specific cinematic camera path target.
33+
- **Double-click (on Canvas)** - Toggle fullscreen mode.
3034

31-
| Key | Action |
32-
| ------------ | ------------------------ |
33-
| `W` | Move model forward (Z+) |
34-
| `S` | Move model backward (Z-) |
35-
| `A` | Move model left (X+) |
36-
| `D` | Move model right (X-) |
37-
| `Q` | Rotate model left |
38-
| `E` | Rotate model right |
39-
| `Z` | Move model down (Y-) |
40-
| `X` | Move model up (Y+) |
41-
| `Arrow Keys` | Pan camera |
35+
---
4236

43-
### Other
37+
## 📁 Modular Project Structure
4438

45-
- **Double-click** - Toggle fullscreen mode
39+
The project has been refactored into a highly clean, decoupled, and modular structure under `src/`:
40+
41+
```
42+
threejs/
43+
├── .github/
44+
│ └── workflows/
45+
│ ├── deploy.yml # CI/CD GitHub Pages deployment workflow
46+
│ └── static.yml # Static hosting check workflow
47+
├── media/
48+
│ └── preview.webp # README live preview media asset
49+
├── public/
50+
│ └── models/
51+
│ └── car.glb # 3D car model GLB asset
52+
├── src/
53+
│ ├── core/
54+
│ │ ├── Scene.js # Scene creation, fog, and background colors
55+
│ │ ├── Camera.js # Perspective camera, path configs, GSAP transition manager
56+
│ │ ├── Renderer.js # WebGLRenderer setups, shadow configurations, resize hooks
57+
│ │ └── Controls.js # OrbitControls initialization and parameters
58+
│ ├── lights/
59+
│ │ └── Lighting.js # Lights rig (ambient, directional, point light underglow)
60+
│ ├── objects/
61+
│ │ ├── Ground.js # Circular metallic ground plane configuration
62+
│ │ └── CarModel.js # GLTF loading, bounds mapping, sub-mesh shadow casting
63+
│ ├── ui/
64+
│ │ └── CinematicUI.js # Letterbox bars, labels, dots, and GSAP preloader fades
65+
│ └── index.css # Global stylesheet, resets, and preloader overlays styling
66+
├── index.html # HTML entry point (links index.css and main.js)
67+
├── main.js # Application orchestrator, event bindings, and animation loops
68+
├── package.json # Project dependencies and building scripts
69+
├── Dockerfile # Docker container settings
70+
└── README.md # This documentation file
71+
```
72+
73+
---
4674

4775
## 🚀 Getting Started
4876

4977
### Prerequisites
50-
5178
- Node.js (v18 or higher recommended)
5279
- npm
5380

54-
### Installation
81+
### Installation & Run
5582

5683
1. Clone the repository:
57-
5884
```bash
5985
git clone <repository-url>
60-
cd threejs
86+
cd threejs-3d-car-viewer
6187
```
6288

6389
2. Install dependencies:
64-
6590
```bash
6691
npm install
6792
```
6893

69-
3. Start the development server:
70-
94+
3. Run the local development server:
7195
```bash
7296
npm run dev
7397
```
7498

75-
4. Open your browser and navigate to the URL shown in the terminal (usually `http://localhost:5173`)
76-
77-
## 📦 Build
78-
79-
To build the project for production:
99+
4. Open your browser and navigate to the local URL (usually `http://localhost:5173/threejs-3d-car-viewer/`).
80100

101+
### Production Build & Preview
102+
To compile the minified bundle:
81103
```bash
82104
npm run build
83105
```
84-
85-
To preview the production build:
86-
106+
To run the production bundle locally:
87107
```bash
88108
npm run preview
89109
```
90-
91-
## 🐳 Docker
92-
93-
### Pull from Docker Hub
94-
95-
The image is available on Docker Hub:
96-
97-
```bash
98-
docker pull omid2831/omid-threejs-app
99-
docker run -p 3000:3000 omid2831/omid-threejs-app
100-
```
101-
102-
🔗 **Docker Hub:** [omid2831/omid-threejs-app](https://hub.docker.com/r/omid2831/omid-threejs-app)
103-
104-
### Build Locally
105-
106-
Or build and run locally with Docker:
107-
108-
```bash
109-
# Build the image
110-
docker build -t threejs-viewer .
111-
112-
# Run the container
113-
docker run -p 3000:3000 threejs-viewer
114-
```
115-
116-
Then open `http://localhost:3000` in your browser.
117-
118-
## 📁 Project Structure
119-
120-
```
121-
threejs/
122-
├── public/
123-
│ └── models/
124-
│ └── car.glb # 3D car model
125-
├── index.html # HTML entry point
126-
├── main.js # Main Three.js application
127-
├── package.json # Project dependencies
128-
├── Dockerfile # Docker configuration
129-
└── README.md # This file
130-
```
131-
132-
## 🛠️ Technologies Used
133-
134-
- **[Three.js](https://threejs.org/)** - 3D graphics library
135-
- **[Vite](https://vitejs.dev/)** - Fast build tool and dev server
136-
- **[GLTFLoader](https://threejs.org/docs/#examples/en/loaders/GLTFLoader)** - For loading 3D models
137-
- **[OrbitControls](https://threejs.org/docs/#examples/en/controls/OrbitControls)** - Camera control system
138-
139-
## 📄 License
140-
141-
ISC
142-
143-
---
144-
145-
Made with ❤️ and Three.js

media/preview.webp

1.88 MB
Loading

0 commit comments

Comments
 (0)