A Tailwind CSS plugin for creating css animations.
npm install tailwindcss-animator> A Tailwind CSS plugin for creating animations.
Install the plugin from npm
``sh`
npm i tailwindcss-animator -D
Then add the plugin to your tailwind.config.js file:
`ts
/* @type {import('tailwindcss').Config} /
module.exports = {
theme: {
extend: {},
},
plugins: [
require('tailwindcss-animator'),
],
}
`
- class ani-{name}
`html`
- class ani-dur-{value}Arbitrary values
- number
- 888 => 888msstring
- 888s => 888s
`html`
- class ani-delay-{value}Arbitrary values
- number
- 888 => 888msstring
- 888s => 888s
`html`
- class ani-ease-{value}Arbitrary values
- number
- 10 => steps(10, end)in
- |out|in-out|linearstart
- => step-startend
- => step-endin-sine
- | out-sine | in-out-sine | in-quad | out-quad | in-out-quad | in-cubic | out-cubic | in-out-cubic | in-quart | out-quart | in-out-quart | in-quint | out-quint | in-out-quint | in-expo | out-expo | in-out-expo | in-circ | out-circ | in-out-circ | in-back | out-back | in-out-bac Will be automatically converted to cubic-bezier
`html`
- class ani-repeat-{value}Arbitrary values
- inf
- | infinite => infinitenumber
- => animation iteration count number
`html`
- class ani-dir-{value}normal
- | reverse | rev | alternate | alt | altrev | alternate-reverseArbitrary values
- : Does not support
`html`
- class ani-mode-{value}none
- | fwd | forwards | bck | backwards | bothArbitrary values
- : Does not support
`html`
- class ani-state-{value}running
- | pausedArbitrary values
- : Does not support
`html`
- class ani-origin-{value}center
- | top | t | top-right | tr | right | r | bottom-right | br | bottom | b | bottom-left | bl | left | l | top-left | tlArbitrary values
- : Does not support
`html`
`ts
/* @type {import('tailwindcss').Config} /
type IPluginOptions = {
// animation class prefix
prefix?: string, // default ani
// default animation properties
properties?: {
animationDelay?: string;
animationDirection?: string;
animationDuration?: string;
animationFillMode?: string;
animationIterationCount?: string;
animationPlayState?: string;
animationTimeingFunction?: string;
backfaceVisibility?: string;
}
}
// tailwind.config.js
plugins: [
require('tailwindcss-animator')({
prefix: 'wow', // 'wow-fade-in'
properties: {
animationDirection: '2000ms'
}
}),
]
``
All themes are defined in the file theme.ts
- animationDelay
- animationDuration
- animationTimingFunction
- animationIterationCount
- animationDirection
- animationFillMode
- animationPlayState
- animationTransformOrigin
This project is licensed under the MIT License.