A collection of modern CSS animations for Tailwind CSS 4, designed to enhance your frontend projects.
npm install @polgubau/animatedA collection of modern CSS animations for Tailwind CSS 4, designed to enhance your frontend projects. π
Install the package via npm or pnpm:
``sh`
npm install @polgubau/animatedor
pnpm add @polgubau/animated
1. Import the CSS file in your index css file:
`css`
@import "tailwindcss";
@import "@polgubau/animated";
2. Use the animations in your Tailwind classes:
`html`
Hello, world!
1. Import the CSS file in your main tsx file:
`css`
import '@polgubau/animated';
Now you can use all keyframes to build you own animations.
`css`
.fade-in {
animation: 3s infinite alternate slide-in-top;
}
@polgubau/animated provides a variety of CSS animations categorized into different groups:
- Blur: animate-blur, animate-blur-pulse, animate-blur-flashanimate-fade-in
- Fade: , animate-fade-out, animate-fade-pulseanimate-grow
- Grow: , animate-grow-pulseanimate-pump
- Pump: , animate-pump-pulseanimate-shake-x
- Shake: , animate-shake-yanimate-shrink
- Shrink: , animate-shrink-pulseanimate-slide-left
- Slide: , animate-slide-right, animate-slide-up, animate-slide-downanimate-wiggle
- Wiggle: animate-flip-x
- Flip: , animate-flip-y, animate-flip-pulseanimate-roll-left
- Roll: , animate-roll-right, animate-roll-pulse
- (More categories coming soon!)
You can customize animation durations and other properties using Tailwindβs utility classes:
`html`
These are the default values:
`css
:root {
--smaller-scale: 0.8;
--larger-scale: 1.2;
--pump-amount: 1.1;
--pump-soft-amount: 1.05;
--pump-hard-amount: 1.2;
--pump-x-amount: 1.1;
--pump-y-amount: 1.1;
--pump-bounce-amount: 1.15;
--blur-amount: 8px;
--slide-amount: 20px;
--slide-amount-negative: calc(-1 * var(--slide-amount));
--rotation: 10deg;
--rotation-negative: calc(-1 * var(--rotation));
--small-rotation: calc(0.5 * var(--rotation));
--small-rotation-negative: calc(-1 * var(--small-rotation));
--shake-amount: 5px;
--shake-amount-negative: calc(-1 * var(--shake-amount));
--movement-distance: 10px;
--fade-scale: 0.95;
--rolled-degree: 360deg;
--rolled-degree-negative: calc(-1 * var(--rolled-degree));
--rolled-distance: 100%;
--rolled-distance-negative: calc(-1 * var(--rolled-distance));
}
If you need a programmatic way to access the available animations, you can import the summary JSON:
`js`
import animationSummary from '@polgubau/animated/summary';
console.log(animationSummary);
The easiest way to work with the project monorepo is to run
`sh``
pnpm dev
in the root directory. This will start a watch build for the package and start a local server to preview the documentation page.
This project is licensed under the MIT License.
---
Made with β€οΈ by Pol Gubau Amores