Skip to content

Commit 691035c

Browse files
committed
update version to 0.1.2
1 parent b9c5f61 commit 691035c

3 files changed

Lines changed: 36 additions & 11 deletions

File tree

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,33 @@ yarn add tailwindcss-animatecss
1616
## Usage
1717

1818
Add Tailwind CSS to your project as described [here](https://tailwindcss.com/docs/installation).
19-
20-
Add plugin to your tailwind config file.
19+
Install tailwindcss plugin as described above and add it to your tailwind.config.js file.
2120

2221
```js
2322
plugins: [
2423
// Other plugins
25-
require('tailwindcss-animatecss')(['responsive']),
24+
require('tailwindcss-animatecss')({
25+
settings: {
26+
animatedSpeed: 1000,
27+
heartBeatSpeed: 1000,
28+
hingeSpeed: 2000,
29+
bounceInSpeed: 750,
30+
bounceOutSpeed: 750
31+
},
32+
variants: ['responsive'],
33+
}),
2634
]
2735
```
2836

37+
### Adjustable, optional settings
38+
* ```animatedSpeed``` used for the animationDuration of the .animated class
39+
* ```heartBeat``` used for the animationDuration of the .heartBeat class
40+
* ```hingeSpeed``` used for the animationDuration of the .hingeSpeed class
41+
* ```bounceInSpeed``` used for the animationDuration of the .bounceInSpeed class
42+
* ```bounceOutSpeed``` used for the animationDuration of the .bounceOutSpeed class
43+
44+
All of these settings are optional, if not set basic animate.css fallback animationDuration speed is used.
45+
2946
The plugin generates all the animate.css utility classes for you.
3047

3148
### Available Animate CSS classes
@@ -79,7 +96,7 @@ The plugin generates all the animate.css utility classes for you.
7996
* .bounceOutLeft
8097
* .bounceOutRight
8198
* .slideInDown
82-
* .slideInLeft
99+
* .slideInLeft
83100
* .slideInRight
84101
* .slideInUp
85102
* .slideOutDown

animate/animate.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,20 @@ const keyframesSlideOut = require('./keyframes/slideOut');
1313
const keyframesFadeIn = require('./keyframes/fadeIn');
1414
const keyframesFadeOut = require('./keyframes/fadeOut');
1515

16-
module.exports = function () {
17-
return function ({ addUtilities, variants }) {
16+
module.exports = function (settings = {}, variants = ['responsive']) {
17+
return function ({ e, addUtilities, variants }) {
18+
19+
// set fallback if speed not defined
20+
const animatedSpeed = settings.settings.animatedSpeed ? settings.settings.animatedSpeed : 1000;
21+
const heartBeatSpeed = settings.settings.heartBeatSpeed ? settings.settings.heartBeatSpeed : 1000;
22+
const hingeSpeed = settings.settings.hingeSpeed ? settings.settings.hingeSpeed : 2000;
23+
const bounceInSpeed = settings.settings.bounceInSpeed ? settings.settings.bounceInSpeed : 750;
24+
const bounceOutSpeed = settings.settings.bounceOutSpeed ? settings.settings.bounceOutSpeed : 750;
25+
const opacity = settings.settings.opacity ? settings.settings.opacity : 1;
1826

1927
addUtilities({
2028
'.animated': {
21-
animationDuration: '1s',
29+
animationDuration: `${animatedSpeed}ms`,
2230
animationFillMode: 'both'
2331
},
2432
'.infinite': {
@@ -59,12 +67,12 @@ module.exports = function () {
5967
},
6068
'.heartBeat': {
6169
animationName: 'heartBeat',
62-
animationDuration: '1s',
70+
animationDuration: `${heartBeatSpeed}ms`,
6371
animationTimingFunction: 'ease-in-out'
6472
},
6573
'.hinge': {
6674
animationName: 'hinge',
67-
animationDuration: '2s',
75+
animationDuration: `${hingeSpeed}ms`,
6876
},
6977
'.jackInTheBox': {
7078
animationName: 'jackInTheBox',
@@ -160,7 +168,7 @@ module.exports = function () {
160168
},
161169
'.bounceOut': {
162170
animationName: 'bounceOut',
163-
animationDuration: '0.75s'
171+
animationDuration: `${bounceOutSpeed}ms`,
164172
},
165173
'.bounceOutDown': {
166174
animationName: 'bounceOutDown',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tailwindcss-animatecss",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "Add Animate CSS as Tailwind CSS plugin to your project.",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)