Skip to content

Commit 045fdb2

Browse files
feat: fork tailwindcss-animate as @opensourceframework/tailwindcss-animate (#107)
Fixes #89 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 69fc554 commit 045fdb2

7 files changed

Lines changed: 7676 additions & 333 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Jamie Kyle
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 297 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,297 @@
1+
# `@opensourceframework/tailwindcss-animate`
2+
3+
> A Tailwind CSS plugin for creating beautiful animations.
4+
>
5+
> **This is a maintained fork** of the original [jamiebuilds/tailwindcss-animate](https://github.com/jamiebuilds/tailwindcss-animate), packaged as a drop-in replacement for the unmaintained `tailwindcss-animate`.
6+
7+
```html
8+
<!-- Add an animated fade and zoom entrance -->
9+
<div class="animate-in fade-in zoom-in">...</div>
10+
11+
<!-- Add an animated slide to top-left exit -->
12+
<div class="animate-out slide-out-to-top slide-out-to-left">...</div>
13+
14+
<!-- Control animation duration -->
15+
<div class="... duration-300">...</div>
16+
17+
<!-- Control animation delay -->
18+
<div class="... delay-150">...</div>
19+
20+
<!-- And so much more! -->
21+
```
22+
23+
## Installation
24+
25+
Install the plugin from npm:
26+
27+
```sh
28+
npm install -D @opensourceframework/tailwindcss-animate
29+
```
30+
31+
Then add the plugin to your `tailwind.config.js` file:
32+
33+
```js
34+
// @filename tailwind.config.js
35+
module.exports = {
36+
theme: {
37+
// ...
38+
},
39+
plugins: [
40+
require("tailwindcss-animate"),
41+
// ...
42+
],
43+
}
44+
```
45+
46+
## Documentation
47+
48+
- [Basic Usage](#basic-usage)
49+
- [Changing animation delay](#changing-animation-delay)
50+
- [Changing animation direction](#changing-animation-direction)
51+
- [Changing animation duration](#changing-animation-duration)
52+
- [Changing animation fill mode](#changing-animation-fill-mode)
53+
- [Changing animation iteration count](#changing-animation-iteration-count)
54+
- [Changing animation play state](#changing-animation-play-state)
55+
- [Changing animation timing function](#changing-animation-timing-function)
56+
- [Prefers-reduced-motion](#prefers-reduced-motion)
57+
- [Enter & Exit Animations](#enter-and-exit-animations)
58+
- [Adding enter animations](#adding-enter-animations)
59+
- [Adding exit animations](#adding-exit-animations)
60+
- [Changing enter animation starting opacity](#changing-enter-animation-starting-opacity)
61+
- [Changing enter animation starting rotation](#changing-enter-animation-starting-rotation)
62+
- [Changing enter animation starting scale](#changing-enter-animation-starting-scale)
63+
- [Changing enter animation starting translate](#changing-enter-animation-starting-translate)
64+
- [Changing exit animation ending opacity](#changing-exit-animation-ending-opacity)
65+
- [Changing exit animation ending rotation](#changing-exit-animation-ending-rotation)
66+
- [Changing exit animation ending scale](#changing-exit-animation-ending-scale)
67+
- [Changing exit animation ending translate](#changing-exit-animation-ending-translate)
68+
69+
### Basic Usage
70+
71+
#### Changing animation delay
72+
73+
Use the `delay-{amount}` utilities to control an element’s `animation-delay`.
74+
75+
```html
76+
<button class="animate-bounce delay-150 duration-300 ...">Button A</button>
77+
<button class="animate-bounce delay-300 duration-300 ...">Button B</button>
78+
<button class="animate-bounce delay-700 duration-300 ...">Button C</button>
79+
```
80+
81+
Learn more in the [animation delay](/docs/animation-delay.md) documentation.
82+
83+
#### Changing animation direction
84+
85+
Use the `direction-{keyword}` utilities to control an element’s `animation-delay`.
86+
87+
```html
88+
<button class="animate-bounce direction-normal ...">Button A</button>
89+
<button class="animate-bounce direction-reverse ...">Button B</button>
90+
<button class="animate-bounce direction-alternate ...">Button C</button>
91+
<button class="animate-bounce direction-alternate-reverse ...">Button C</button>
92+
```
93+
94+
Learn more in the [animation direction](/docs/animation-direction.md) documentation.
95+
96+
#### Changing animation duration
97+
98+
Use the `duration-{amount}` utilities to control an element’s `animation-duration`.
99+
100+
```html
101+
<button class="animate-bounce duration-150 ...">Button A</button>
102+
<button class="animate-bounce duration-300 ...">Button B</button>
103+
<button class="animate-bounce duration-700 ...">Button C</button>
104+
```
105+
106+
Learn more in the [animation duration](/docs/animation-duration.md) documentation.
107+
108+
#### Changing animation fill mode
109+
110+
Use the `fill-mode-{keyword}` utilities to control an element’s `animation-fill-mode`.
111+
112+
```html
113+
<button class="animate-bounce fill-mode-none ...">Button A</button>
114+
<button class="animate-bounce fill-mode-forwards ...">Button B</button>
115+
<button class="animate-bounce fill-mode-backwards ...">Button C</button>
116+
<button class="animate-bounce fill-mode-both ...">Button C</button>
117+
```
118+
119+
Learn more in the [animation fill mode](/docs/animation-fill-mode.md) documentation.
120+
121+
#### Changing animation iteration count
122+
123+
Use the `repeat-{amount}` utilities to control an element’s `animation-iteration-count`.
124+
125+
```html
126+
<button class="animate-bounce repeat-0 ...">Button A</button>
127+
<button class="animate-bounce repeat-1 ...">Button B</button>
128+
<button class="animate-bounce repeat-infinite ...">Button C</button>
129+
```
130+
131+
Learn more in the [animation iteration count](/docs/animation-iteration-count.md) documentation.
132+
133+
#### Changing animation play state
134+
135+
Use the `running` and `paused` utilities to control an element’s `animation-play-state`.
136+
137+
```html
138+
<button class="animate-bounce running ...">Button B</button>
139+
<button class="animate-bounce paused ...">Button A</button>
140+
```
141+
142+
Learn more in the [animation play state](/docs/animation-play-state.md) documentation.
143+
144+
#### Changing animation timing function
145+
146+
Use the `ease-{keyword}` utilities to control an element’s `animation-timing-function`.
147+
148+
```html
149+
<button class="animate-bounce ease-linear ...">Button A</button>
150+
<button class="animate-bounce ease-in ...">Button B</button>
151+
<button class="animate-bounce ease-out ...">Button C</button>
152+
<button class="animate-bounce ease-in-out ...">Button C</button>
153+
```
154+
155+
Learn more in the [animation timing function](/docs/animation-timing-function.md) documentation.
156+
157+
#### Prefers-reduced-motion
158+
159+
For situations where the user has specified that they prefer reduced motion, you can conditionally apply animations and transitions using the `motion-safe` and `motion-reduce` variants:
160+
161+
```html
162+
<button class="motion-safe:animate-bounce ...">Button B</button>
163+
```
164+
165+
### Enter & Exit Animations
166+
167+
### Adding enter animations
168+
169+
To give an element an enter animation, use the `animate-in` utility, in combination with some [`fade-in`](/docs/enter-animation-scale.md), [`spin-in`](/docs/enter-animation-rotate.md), [`zoom-in`](/docs/enter-animation-scale.md), and [`slide-in-from`](/docs/enter-animation-translate.md) utilities.
170+
171+
```html
172+
<button class="animate-in fade-in ...">Button A</button>
173+
<button class="animate-in spin-in ...">Button B</button>
174+
<button class="animate-in zoom-in ...">Button C</button>
175+
<button class="animate-in slide-in-from-top ...">Button D</button>
176+
<button class="animate-in slide-in-from-left ...">Button E</button>
177+
```
178+
179+
Learn more in the [enter animation](/docs/enter-animation.md) documentation.
180+
181+
### Adding exit animations
182+
183+
To give an element an exit animation, use the `animate-out` utility, in combination with some [`fade-out`](/docs/exit-animation-scale.md), [`spin-out`](/docs/exit-animation-rotate.md), [`zoom-out`](/docs/exit-animation-scale.md), and [`slide-out-from`](/docs/exit-animation-translate.md) utilities.
184+
185+
```html
186+
<button class="animate-out fade-out ...">Button A</button>
187+
<button class="animate-out spin-out ...">Button B</button>
188+
<button class="animate-out zoom-out ...">Button C</button>
189+
<button class="animate-out slide-out-from-top ...">Button D</button>
190+
<button class="animate-out slide-out-from-left ...">Button E</button>
191+
```
192+
193+
Learn more in the [exit animation](/docs/exit-animation.md) documentation.
194+
195+
#### Changing enter animation starting opacity
196+
197+
Set the starting opacity of an animation using the `fade-in-{amount}` utilities.
198+
199+
```html
200+
<button class="animate-in fade-in ...">Button A</button>
201+
<button class="animate-in fade-in-25 ...">Button B</button>
202+
<button class="animate-in fade-in-50 ...">Button C</button>
203+
<button class="animate-in fade-in-75 ...">Button C</button>
204+
```
205+
206+
Learn more in the [enter animation opacity](/docs/enter-animation-opacity.md) documentation.
207+
208+
#### Changing enter animation starting rotation
209+
210+
Set the starting rotation of an animation using the `spin-in-{amount}` utilities.
211+
212+
```html
213+
<button class="animate-in spin-in-1 ...">Button A</button>
214+
<button class="animate-in spin-in-6 ...">Button B</button>
215+
<button class="animate-in spin-in-75 ...">Button C</button>
216+
<button class="animate-in spin-in-90 ...">Button C</button>
217+
```
218+
219+
Learn more in the [enter animation rotate](/docs/enter-animation-rotate.md) documentation.
220+
221+
#### Changing enter animation starting scale
222+
223+
Set the starting scale of an animation using the `zoom-in-{amount}` utilities.
224+
225+
```html
226+
<button class="animate-in zoom-in ...">Button A</button>
227+
<button class="animate-in zoom-in-50 ...">Button B</button>
228+
<button class="animate-in zoom-in-75 ...">Button C</button>
229+
<button class="animate-in zoom-in-95 ...">Button C</button>
230+
```
231+
232+
Learn more in the [enter animation scale](/docs/enter-animation-scale.md) documentation.
233+
234+
#### Changing enter animation starting translate
235+
236+
Set the starting translate of an animation using the `slide-in-from-{direction}-{amount}` utilities.
237+
238+
```html
239+
<button class="animate-in slide-in-from-top ...">Button A</button>
240+
<button class="animate-in slide-in-from-bottom-48 ...">Button B</button>
241+
<button class="animate-in slide-in-from-left-72 ...">Button C</button>
242+
<button class="animate-in slide-in-from-right-96 ...">Button C</button>
243+
```
244+
245+
Learn more in the [enter animation translate](/docs/enter-animation-translate.md) documentation.
246+
247+
#### Changing exit animation ending opacity
248+
249+
Set the ending opacity of an animation using the `fade-out-{amount}` utilities.
250+
251+
```html
252+
<button class="animate-out fade-out ...">Button A</button>
253+
<button class="animate-out fade-out-25 ...">Button B</button>
254+
<button class="animate-out fade-out-50 ...">Button C</button>
255+
<button class="animate-out fade-out-75 ...">Button C</button>
256+
```
257+
258+
Learn more in the [exit animation opacity](/docs/exit-animation-opacity.md) documentation.
259+
260+
#### Changing exit animation ending rotation
261+
262+
Set the ending rotation of an animation using the `spin-out-{amount}` utilities.
263+
264+
```html
265+
<button class="animate-out spin-out-1 ...">Button A</button>
266+
<button class="animate-out spin-out-6 ...">Button B</button>
267+
<button class="animate-out spin-out-75 ...">Button C</button>
268+
<button class="animate-out spin-out-90 ...">Button C</button>
269+
```
270+
271+
Learn more in the [exit animation rotate](/docs/exit-animation-rotate.md) documentation.
272+
273+
#### Changing exit animation ending scale
274+
275+
Set the ending scale of an animation using the `zoom-out-{amount}` utilities.
276+
277+
```html
278+
<button class="animate-out zoom-out ...">Button A</button>
279+
<button class="animate-out zoom-out-50 ...">Button B</button>
280+
<button class="animate-out zoom-out-75 ...">Button C</button>
281+
<button class="animate-out zoom-out-95 ...">Button C</button>
282+
```
283+
284+
Learn more in the [exit animation scale](/docs/exit-animation-scale.md) documentation.
285+
286+
#### Changing exit animation ending translate
287+
288+
Set the ending translate of an animation using the `slide-out-to-{direction}-{amount}` utilities.
289+
290+
```html
291+
<button class="animate-out slide-out-to-top ...">Button A</button>
292+
<button class="animate-out slide-out-to-bottom-48 ...">Button B</button>
293+
<button class="animate-out slide-out-to-left-72 ...">Button C</button>
294+
<button class="animate-out slide-out-to-right-96 ...">Button C</button>
295+
```
296+
297+
Learn more in the [exit animation translate](/docs/exit-animation-translate.md) documentation.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare const plugin: { handler: () => void }
2+
3+
export = plugin

0 commit comments

Comments
 (0)