Skip to content

Commit e3be205

Browse files
committed
docs: massive improvement in readability for docs
1 parent 2be9536 commit e3be205

4 files changed

Lines changed: 65 additions & 31 deletions

File tree

README.md

Lines changed: 65 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66

77
[NPM](https://www.npmjs.com/package/postcss-spring-easing) <span style="padding-inline: 1rem">|</span> [GitHub](https://github.com/okikio/postcss-spring-easing#readme) <span style="padding-inline: 1rem">|</span> [Licence](./LICENSE)
88

9-
PostCSS plugin to replace `spring()` functions with a `linear()` easing function. Inspired by [postcss-easings](https://github.com/postcss/postcss-easings).
9+
Want your CSS animations to bounce and boogie 🕺 ? You've come to the right place!
10+
11+
This PostCSS plugin gives your CSS the superpower to create "spring" animations, bringing your websites to life! Inspired by [postcss-easings](https://github.com/postcss/postcss-easings), it replaces `spring()` functions with a `linear()` easing function.
12+
13+
14+
Here's a glimpse of how you can use it in your CSS:
1015

1116
```css
1217
.snake {
@@ -17,6 +22,8 @@ PostCSS plugin to replace `spring()` functions with a `linear()` easing function
1722
}
1823
```
1924

25+
And here's what it looks like once `postcss-spring-easing` works its magic:
26+
2027
```css
2128
.snake {
2229
--spring-duration: 1333.33ms;
@@ -30,11 +37,16 @@ PostCSS plugin to replace `spring()` functions with a `linear()` easing function
3037

3138
> _**Note**: all the easings [spring-easing](https://github.com/okikio/spring-easing) supports `postcss-spring-easing` supports as well._
3239
33-
<!-- > You can also read the [blog post](https://blog.okikio.dev/postcss-spring-easing), created for it's launch. -->
40+
## Why use postcss-spring-easing? 🤔
3441

35-
You can create animation's like this with `postcss-spring-easing`,
42+
CSS is great for designing your websites, including adding animations. But there are certain animation types, like a "spring" animation (imagine a bouncy ball), which CSS alone can't pull off.
3643

37-
<img src="media/assets/spring-easing-demo-video.gif" width="1920" loading="lazy" alt="A demo of the various postcss-spring-easings available" align="center" style="border-radius: 1rem; aspect-ratio: auto 1920 / 899;" />
44+
> **Fun fact**: "spring" animations are how Apple is able to create smooth animations for the iPhone.
45+
46+
47+
<!-- > You can also read the [blog post](https://blog.okikio.dev/postcss-spring-easing), created for it's launch. -->
48+
49+
<img src="media/assets/spring-easing-demo-video.gif" width="1280" loading="lazy" alt="A demo of the various postcss-spring-easings available" align="center" style="border-radius: 1rem; aspect-ratio: auto 1280 / 920;" />
3850

3951

4052
<!-- https://github.com/okikio/postcss-spring-easing/assets/17222836/3813945f-b301-4399-8383-bbab227c3f68
@@ -43,7 +55,13 @@ You can create animation's like this with `postcss-spring-easing`,
4355
<source src="media/assets/postcss-spring-easing-demo-video.mp4" type="video/mp4">
4456
</video> -->
4557

46-
> _Check out the spring easing variants on [Codepen](https://codepen.io/okikio/pen/MWEMEgJ)._
58+
> _Check out more examples on [Codepen](https://codepen.io/okikio/pen/MWEMEgJ)._
59+
60+
`postcss-spring-easing` comes to your rescue! It's a plugin for PostCSS, which enhances the capabilities of your CSS. This plugin helps you craft spring animations effortlessly.
61+
62+
In a nutshell, `postcss-spring-easing` is a simple and effective tool for creating bouncy animations with minimum fuss, making your web pages more dynamic and fun.
63+
64+
Let's get coding! 🚀
4765

4866
## Installation
4967

@@ -66,42 +84,29 @@ pnpm install postcss-spring-easing
6684

6785
</details>
6886

87+
## Setting up PostCSS
6988

70-
## Usage
89+
To use this plugin, you need to have PostCSS set up in your project. If you haven't already, follow these steps:
7190

72-
```ts
73-
import { springEasingPlugin } from "postcss-spring-easing";
74-
// or
75-
import springEasingPlugin from "postcss-spring-easing";
91+
First, install PostCSS:
92+
93+
```bash
94+
npm install postcss
7695
```
7796

78-
You can also use it directly through a script tag:
97+
<details>
98+
<summary>Others</summary>
7999

80-
```html
81-
<script src="https://unpkg.com/postcss-spring-easing" type="module"></script>
82-
<script type="module">
83-
// You can then use it like this
84-
const { springEasingPlugin } = window.PostcssSpringEasing;
85-
</script>
100+
```bash
101+
yarn add postcss
86102
```
87103

88-
You can also use it via a CDN, e.g.
104+
or
89105

90-
```ts
91-
import { springEasingPlugin } from "https://esm.run/postcss-spring-easing";
92-
// or
93-
import { springEasingPlugin } from "https://esm.sh/postcss-spring-easing";
94-
// or
95-
import { springEasingPlugin } from "https://unpkg.com/postcss-spring-easing";
96-
// or
97-
import { springEasingPlugin } from "https://cdn.skypack.dev/postcss-spring-easing";
98-
// or
99-
import { springEasingPlugin } from "https://deno.bundlejs.com/file?q=postcss-spring-easing";
100-
// or any number of other CDN's
106+
```bash
107+
pnpm install postcss
101108
```
102109

103-
## Setup
104-
105110
Check your project for an existing PostCSS config: `postcss.config.js` in the project root,`"postcss"` section in the `package.json` or `postcss` in your bundle config.
106111

107112
Add the plugin to plugins list:
@@ -133,6 +138,35 @@ var output = postcss()
133138
```
134139
Checkout [tests](./tests/) for more examples.
135140

141+
142+
## Usage
143+
144+
To create a spring animation, you just need to write your CSS transitions as usual, but replace the timing function with one of the following:
145+
146+
* `spring`
147+
* `spring-in`
148+
* `spring-out`
149+
* `spring-in-out`
150+
* `spring-out-in`
151+
152+
Each of these represents a different type of spring effect.
153+
154+
For example:
155+
156+
```css
157+
.box {
158+
transition: transform 1s spring-out;
159+
}
160+
```
161+
162+
This will give a spring effect to the transform transition of the `.box` element.
163+
164+
The `spring-out` function here means that the animation will start slowly and end quickly, like a spring being released. Similarly, `spring-in` would start quickly and end slowly, and `spring-in-out` would start and end slowly with a quick middle, resembling the movement of a bouncing spring.
165+
166+
Now your animations are ready to bounce!
167+
168+
Have questions? Or just wanna talk--leave a message on [GitHub Discussions](https://github.com/okikio/postcss-spring-easing/discussions/1)
169+
136170
## Showcase
137171

138172
A couple sites/projects that use `postcss-spring-easing`:
320 KB
Loading
-1.68 MB
Binary file not shown.
-374 KB
Binary file not shown.

0 commit comments

Comments
 (0)