English | 简体中文
声明式编写 animation 属性的插件,提供了常用的 animation 属性,同时可以使用[配置](#Config mode)添加新的属性,或者可以采用JIT动态编写 animaton 属性。
# Using npm
npm i tailwindcss-animation-property
# Using yarn
yarn add tailwindcss-animation-property
Then add the plugin to your tailwind.config.js
file:
// tailwind.config.js
module.exports = {
theme: {
// ...
},
plugins: [
// ...
require("tailwindcss-animation-property")(),
],
};
<div className="animation-duration-1s"></div>
animation-duration-1s
解析成 animation-duration:1s
, 插件内置时间为 1s
,2s
,3s
,4s
,5s
.
- animation-duration
- animation-duration-[100ms] ->
animation-duration: 100ms
- animation-duration-[10s] ->
animation-duration: 10s
- animation-duration-[100ms] ->
插件可以通过传递 animation property 参数的方式,传递自定义的属性值
require("../dist/index.js")({
animationDuration: ["500ms", "6s", "0.5s"],
animationDelay: ["2000ms", "3s"],
animationIterationCount: [10, 20],
});
所有的动画名称均以 magic
开头,然后下划线之后是“真正的”动画名称(magic-puffIn
, magic-openDownLeft
...),全部的动画名称列表如下:
.
├── magic
│ |── magic
│ |── twisterInDown
│ |── twisterInUp
│ └── swap
├── bling
│ |── puffIn
│ |── puffOut
│ |── vanishIn
│ └── vanishOut
├── staticEffects
│ |── openDownLeft
│ |── openDownLeftReturn
│ |── openDownRight
│ |── openDownRightReturn
│ |── openUpLeft
│ |── openUpLeftReturn
│ |── openUpRight
│ └── openUpRightReturn
├── staticEffectsOut
│ |── openDownLeftOut
│ |── openDownRightOut
│ |── openUpLeftOut
│ └── openUpRightOut
├── perspective
│ |── perspectiveDown
│ |── perspectiveDownReturn
│ |── perspectiveLeft
│ |── perspectiveLeftReturn
│ |── perspectiveRight
│ |── perspectiveRightReturn
│ |── perspectiveUp
│ └── perspectiveUpReturn
├── rotate
│ |── rotateDownIn
│ |── rotateDownOut
│ |── rotateLeftIn
│ |── rotateLeftOut
│ |── rotateRightIn
│ |── rotateRightOut
│ |── rotateUpIn
│ └── rotateUpOut
├── slide
│ |── slideDown
│ |── slideDownReturn
│ |── slideLeft
│ |── slideLeftReturn
│ |── slideRight
│ |── slideRightReturn
│ |── slideUp
│ └── slideUpReturn
├── math
│ |── foolishIn
│ |── foolishOut
│ |── holeIn
│ |── holeOut
│ |── swashIn
│ └── swashOut
├── tin
│ |── tinDownIn
│ |── tinDownOut
│ |── tinLeftIn
│ |── tinLeftOut
│ |── tinRightIn
│ |── tinRightOut
│ |── tinUpIn
│ └── tinUpOut
├── bomb
│ |── bombLeftOut
│ └── bombRightOut
├── boing
│ |── boingInUp
│ └── boingOutDown
├── space
│ |── spaceInDown
│ |── spaceInLeft
│ |── spaceInRight
│ |── spaceInUp
│ |── spaceOutDown
│ |── spaceOutLeft
│ |── spaceOutRight
│ └── spaceOutUp
- 📦 打包
yarn
yarn build
- 单元测试
npm run test
- 添加线上 DEMO