-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
82 lines (78 loc) · 1.88 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { makeClassName as m } from './util'
import shakeAnimates, { shakeKeyframes } from './anims/shake'
import rippleAnimates, { rippleKeyframes } from './anims/ripple'
import breathAnimates, { breathKeyframes } from './anims/breath'
import jumpAnimates, { jumpKeyframes } from './anims/jump'
import flickerAnimates, { flickerKeyframes } from './anims/flicker'
import plugin from 'tailwindcss/plugin'
export default plugin(
({ addUtilities, theme, addBase, addVariant, matchComponents }) => {
// basic animations
addUtilities({
...shakeAnimates(theme),
...rippleAnimates(theme),
...breathAnimates(theme),
...jumpAnimates(theme),
...flickerAnimates(theme),
[m('float')]: {},
[m('spin')]: {},
})
// animation counts
matchComponents(
{
'ani-count': (value) => ({
animationIterationCount: `${value} !important`,
}),
},
{ values: theme('ani.count'), type: 'number' },
)
// animation
matchComponents(
{
'ani-duration': (value) => ({
animationDuration: `${value} !important`,
}),
},
{ values: theme('ani.duration') },
)
},
{
theme: {
extend: {
keyframes: {
...shakeKeyframes,
...rippleKeyframes,
...breathKeyframes,
...jumpKeyframes,
...flickerKeyframes,
},
},
ani: {
count: {
1: '1',
2: '2',
3: '3',
4: '4',
5: '5',
6: '6',
7: '7',
8: '8',
9: '9',
10: '10',
infinite: 'infinite',
},
duration: {
1: '1s',
2: '2s',
3: '3s',
200: '200ms',
300: '300ms',
400: '400ms',
500: '500ms',
800: '800ms',
1000: '1000ms',
},
},
},
},
)