This is a Next.js project that integrates interactive 3D content and custom animations using the Spline tool and Framer Motion. It creates an immersive and dynamic web experience with text animations and 3D models, designed with a visually striking gradient background.
- Text Animation: The text ("輝け、未来") appears with a delay effect using Framer Motion for smooth transitions.
- 3D Spline Integration: A 3D model created with Spline is embedded and lazily loaded for improved performance.
- Gradient Backgrounds: A custom gradient background with a vignette effect that adapts to dark mode.
- Custom Font Styling: The project uses the 'Yuji Mai' font from Google Fonts for a unique and authentic design.
- Next.js: A React-based framework for building static and dynamic websites.
- Framer Motion: A library for animations that provides smooth transitions and effects.
- Spline: A tool for building and integrating 3D web content.
- Tailwind CSS: A utility-first CSS framework for rapid UI development.
- React Suspense: Used for loading the 3D scene asynchronously.
- Google Fonts: 'Yuji Mai' font for typography styling.
To get started with this project, follow these steps:
-
Clone this repository to your local machine:
git clone <repository-url>
-
Install the dependencies:
npm install
-
Run the development server:
npm run dev
-
Open your browser and visit:
http://localhost:3000
-
Text Component:
- The
Textcomponent renders each character with an animation that fades in with a staggered delay. - This is achieved using
motion.divfrom Framer Motion.
- The
-
3D Scene:
- The 3D model is loaded lazily using
React.lazy()for better performance. - The model is displayed using the
<Spline>component wrapped in aSuspensecomponent, which shows a fallback loading screen until the 3D model is ready.
- The 3D model is loaded lazily using
-
Root Layout:
- The layout sets the background and font style. It also applies a vignette effect using a custom CSS class.
- The root font is set to 'Yuji Mai' from Google Fonts, providing a unique typography style to the web page.
-
Tailwind CSS:
- Tailwind is used for styling the overall layout, buttons, and gradients. It provides utility classes for fast and responsive styling.
- Custom media queries adjust the color scheme based on the user’s preferences (dark mode).
- components/text.js: Contains the text animation logic using Framer Motion.
- pages/index.js: The main page that includes the 3D model and text animations.
- pages/_app.js: The global layout and font styling are applied here.
- styles/globals.css: Contains custom global styles and tailwind imports.
- Text: To change the animated text, simply modify the
textarray inText.jswith new characters. - 3D Model: To replace the 3D scene, update the
sceneprop inside the<Spline>component with the new Spline URL. - Styling: You can customize the background gradients, button styles, and animations using Tailwind classes in
globals.cssor directly in JSX.
Feel free to fork the repository and submit pull requests with improvements or bug fixes. If you encounter any issues, open an issue to discuss them.
This project is licensed under the MIT License - see the LICENSE file for details.
- Spline: Used for creating interactive 3D models.
- Framer Motion: Provides smooth animations for React components.
- Tailwind CSS: For rapid styling and utility-first design.
Enjoy building your creative and interactive web experiences with this template!