This is a Next.js animation boilerplate using GSAP and Lenis.
This boilerplate comes equipped with a set of utilities and configurations to jump-start your Next.js project with animations:
- GSAP: For creating high-performance animations.
- Lenis: For smooth scrolling experiences.
- TailwindCSS: For utility-first styling.
- Zustand: For simple, yet powerful state management.
timeAgo(timestamp, timeOnly)
: Calculates how long ago a date was from the current time.capitalize(string)
: Capitalizes the first letter of a string.cn(...classes)
: Combines class names and merges Tailwind CSS classes conditionally.truncate(string, length)
: Truncates a string to a specified length and appends an ellipsis.preloadImages(selector)
: Preloads images specified by the CSS selector to improve page loading time.
Example usages of these utilities can be found in the documentation section of each utility function within the codebase.
To get started with this Next.js animation boilerplate, follow these steps to set up the project on your local machine.
- Node.js (LTS version recommended)
- npm or yarn
- Clone the repository:
git clone https://github.com/madflows/nextjs-animation-boilerplate.git
- Install the dependencies:
npm install
# or
yarn
- Start the development server:
npm run dev
# or
yarn dev
- Open your browser and navigate to
http://localhost:3000
. - You should see the boilerplate homepage with a title and a description.
- You can customize the title and description by editing the
pages/index.js
file. - You can also add more pages to the
pages
directory and navigate to them using the URL bar.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE
file for more information.