Skip to content

Commit b6fdb26

Browse files
committed
feat(package):add readme
1 parent 2ef16b8 commit b6fdb26

File tree

3 files changed

+71
-3
lines changed

3 files changed

+71
-3
lines changed

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# tailwindcss-spring
2+
3+
A Tailwind CSS plugin that adds spring animations to your project using CSS linear().
4+
Define just two parameters and let the plugin generate the easing curve and the animation duration.
5+
6+
Check out the the plugin in action on [this website](https://tailwindcss-spring.kvin.me/).
7+
8+
## Parameters
9+
10+
- `spring-bounce-*`
11+
- `spring-duration-*`
12+
13+
Example:
14+
15+
```html
16+
<div class="spring-bounce-60 spring-duration-300 transition-transform hover:scale-150"
17+
```
18+
19+
## Installation
20+
21+
Install the plugin via npm:
22+
23+
```bash
24+
npm install tailwindcss-spring
25+
```
26+
27+
Then, add the plugin to your `tailwind.config.js` file:
28+
29+
```javascript
30+
// tailwind.config.js
31+
module.exports = {
32+
theme: {
33+
// ...
34+
},
35+
plugins: [
36+
require("tailwindcss-spring"),
37+
// ...
38+
],
39+
};
40+
```
41+
42+
## Usage
43+
44+
### `spring-bounce-*`
45+
46+
This class defines the bounce (as a percentage), generates the easing curve, and applies it to the `transition-timing-function`.
47+
48+
- I recommend using low bounce values for most animations unless you want a springy effect.
49+
50+
### `spring-duration-*`
51+
52+
This class defines the perceptual duration of the animation in milliseconds.
53+
54+
- The perceptual duration allows you to intuitively configure the animation, focusing on the most significant part of the motion.
55+
56+
- Since spring easings often have long settling periods, the perceptual duration isn't used as the actual animation duration. Instead, the real duration is calculated based on the `spring-bounce-*` value.
57+
58+
## More Info
59+
60+
This plugin was created by [Kevin Grajeda](https://x.com/k_grajeda). It's open source and available on [GitHub](https://github.com/KevinGrajeda/tailwindcss-spring).
61+
62+
You can also check out my [CSS spring easing generator](https://www.kvin.me/css-springs).
63+
64+
A special thanks to [Jake Archibald](https://x.com/jaffathecake) for his work on the [linear easing generator](https://linear-easing-generator.netlify.app/). I used some of [his](https://github.com/jakearchibald/linear-easing-generator) code for spring calculations.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "tailwindcss-spring",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "A Tailwind CSS plugin that adds spring animations to your project using CSS linear(). Define just two parameters and let the plugin generate the easing curve and the animation duration.",
55
"license": "MIT",
66
"main": "./src/index.js",
77
"type": "module",
88
"homepage": "https://tailwindcss-spring.kvin.me/",
9+
"repository": "https://github.com/KevinGrajeda/tailwindcss-spring",
910
"scripts": {
1011
"test": "vitest"
1112
},

web/src/app/page.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,12 @@ export default function Home() {
6161
</div>
6262
</div>
6363
<p className="mt-4">
64-
A Tailwind CSS plugin that adds spring animations to your project.
64+
A Tailwind CSS plugin that adds spring easings using CSS linear() making
65+
it easy to incorporate spring animations into your project.
66+
</p>
67+
<p className="mt-4">
68+
Define just two parameters and let the plugin do the rest.
6569
</p>
66-
<p>Define just two parameters and let the plugin do the rest.</p>
6770
<SpringEditor />
6871
<h2 className="mt-8 text-xl font-bold tracking-tight">Installation</h2>
6972
<p className="mt-4">Install the plugin</p>

0 commit comments

Comments
 (0)