3D PhoneX Website is a React-based web application that provides an interactive 3D model viewer for smartphone products. The application features real-time customization capabilities, including color selection, scaling adjustments, and texture mapping.
- Framework: React with TypeScript
- Build Tool: Vite
- State Management: Zustand
- 3D Rendering: Three.js
- Styling: Tailwind
- Class Name Utility: clsx
- Linting: ESLint
src/
├── components/
│ ├── Lighter.tsx
│ ├── ModelView.tsx
│ └── models/
│ └── Samsung_galaxy_s22_ultra.jsx
├── store/
│ └── index.tsx # Global state management
├── assets/ # Static assets
├── App.tsx # Root component
├── App.css # Global styles
├── main.tsx # Application entry point
└── index.css # Global styles
The application uses Zustand for lightweight global state management with the following features:
- Color Customization: Users can change the phone color from a predefined Solarized palette
- Scale Control: Adjust the 3D model scale (default: 0.08)
- Reset Functionality: Restore all settings to defaults
The solarized palette includes 16 carefully selected colors for consistent UI/UX design.
The noChangeParts array defines model components that remain unchanged during customization:
- Object_2
- Object_10
- Object_11
- Object_12
- Object_13
- Object_23
- Object_26
The main application component renders the ModelView component, which serves as the primary user interface for 3D model interaction.
- Node.js 16+
- npm or yarn package manager
npm installnpm run devThe application will be available at http://localhost:5173 (default Vite port).
npm run buildnpm run previewvite.config.ts- Vite build configurationtsconfig.json- TypeScript compiler optionspackage.json- Project dependencies and scriptseslint.config.js- Code quality rules
import usePhoneXStore from './store';
function MyComponent() {
const color = usePhoneXStore((state) => state.color);
const setColor = usePhoneXStore((state) => state.setColor);
return (
<button onClick={() => setColor('#dc322f')}>
Change to Red
</button>
);
}- Additional phone models
- Extended texture library
- Real-time rendering optimization
- Mobile responsive design
- Animation controls