@penner/responsive-easing 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +109 -0
- package/package.json +95 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Robert Penner
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Responsive Easing
|
|
2
|
+
|
|
3
|
+
> Context-aware easing functions for smooth, perceptually coherent motion across responsive UIs.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/responsive-easing)
|
|
6
|
+
|
|
7
|
+
Responsive Easing adapts motion curves to real-world context—distance, time, and velocity—so animations feel smooth and natural across screen sizes, layouts, and motion segments.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## ✨ Why Responsive Easing?
|
|
12
|
+
|
|
13
|
+
Most easing functions assume a fixed range of motion from 0 to 1. But UI elements don’t always move the same distance or take the same time.
|
|
14
|
+
|
|
15
|
+
This leads to:
|
|
16
|
+
- Motion that feels too fast on large screens
|
|
17
|
+
- Overshoots that don’t scale properly
|
|
18
|
+
- Janky joins between motion segments
|
|
19
|
+
- Manual tweaking of durations and curves for each use case
|
|
20
|
+
|
|
21
|
+
**Responsive Easing solves this** by working in real units: pixels, milliseconds, slopes. It lets you create physically coherent motion that scales with your UI.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 🚀 Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install responsive-easing
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or with Yarn:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
yarn add responsive-easing
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 🧪 Basic Usage
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { createResponsiveEasing } from 'responsive-easing';
|
|
43
|
+
|
|
44
|
+
const easing = createResponsiveEasing({
|
|
45
|
+
distance: 400, // in pixels
|
|
46
|
+
duration: 600, // in milliseconds
|
|
47
|
+
overshoot: true,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const y = easing(0.5); // evaluates easing at halfway point
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Or generate a CSS timing string:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { easingToCssLinear } from 'responsive-easing';
|
|
57
|
+
|
|
58
|
+
const linearString = easingToCssLinear(easing);
|
|
59
|
+
// → linear(0 0, 0.2 0.1, 0.5 0.7, 1 1)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🧰 Features
|
|
65
|
+
|
|
66
|
+
- ✅ **Distance-aware easing**
|
|
67
|
+
- ✅ **Cruise segments** with constant velocity
|
|
68
|
+
- ✅ **Responsive overshoot / bounce**
|
|
69
|
+
- ✅ **Velocity-matched joins**
|
|
70
|
+
- ✅ **Composable easing parts** (intro, cruise, outro)
|
|
71
|
+
- ✅ **Exportable to CSS `linear()` timing functions**
|
|
72
|
+
- ✅ Works with any animation system (CSS, JS, Web Animations API, GSAP, Framer Motion)
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 📦 Demos
|
|
77
|
+
|
|
78
|
+
- [Live playground (CodeSandbox)](TODO)
|
|
79
|
+
- [Comparison to traditional easing](TODO)
|
|
80
|
+
- [Curve visualizer](TODO)
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 📚 Documentation
|
|
85
|
+
|
|
86
|
+
- [Getting Started](TODO)
|
|
87
|
+
- [API Reference](TODO)
|
|
88
|
+
- [Design Principles](TODO)
|
|
89
|
+
- [FAQ](TODO)
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 🧠 Philosophy
|
|
94
|
+
|
|
95
|
+
Responsive Easing treats motion as a first-class design element—one that should respond to space and time, just like layout does. If your UI adapts responsively, your motion should too.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 💬 Feedback & Contributions
|
|
100
|
+
|
|
101
|
+
Have an idea? Find a bug? Want to shape the future of motion?
|
|
102
|
+
|
|
103
|
+
[Open an issue](https://github.com/yourusername/responsive-easing/issues) or [start a discussion](https://github.com/yourusername/responsive-easing/discussions).
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 📄 License
|
|
108
|
+
|
|
109
|
+
MIT © [Robert Penner](https://github.com/robertpenner)
|
package/package.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@penner/responsive-easing",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Responsive Easing is a library that dynamically generates easing functions for motion design that intelligently responds to varying conditions.",
|
|
5
|
+
"author": "Robert Penner <robert@robertpenner.com> (https://robertpenner.com)",
|
|
6
|
+
"homepage": "https://github.com/robertpenner/responsive-easing",
|
|
7
|
+
"repository": "github:robertpenner/responsive-easing",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"easing",
|
|
14
|
+
"animation",
|
|
15
|
+
"motion",
|
|
16
|
+
"physics",
|
|
17
|
+
"responsive",
|
|
18
|
+
"typescript",
|
|
19
|
+
"npm",
|
|
20
|
+
"package"
|
|
21
|
+
],
|
|
22
|
+
"main": "dist/index.cjs.js",
|
|
23
|
+
"module": "dist/index.es.js",
|
|
24
|
+
"types": "dist/index.d.ts",
|
|
25
|
+
"type": "module",
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"dev": "tsc && vite build --watch",
|
|
31
|
+
"start": "vite --host --open",
|
|
32
|
+
"build": "tsc && vite build",
|
|
33
|
+
"build:types": "dts-bundle-generator --config ./dts-bundle-generator.config.ts",
|
|
34
|
+
"lint:scripts": "eslint ./src --ext .ts",
|
|
35
|
+
"lint:styles": "stylelint ./**/*.{css,scss}",
|
|
36
|
+
"format:scripts": "prettier ./src --write",
|
|
37
|
+
"format:styles": "stylelint ./**/*.{css,scss} --fix",
|
|
38
|
+
"test": "vitest run",
|
|
39
|
+
"test:watch": "vitest",
|
|
40
|
+
"storybook": "storybook dev -p 6006",
|
|
41
|
+
"build-storybook": "storybook build -o storybook-static/storybook",
|
|
42
|
+
"deploy-storybook": "gh-pages -d storybook-static/storybook"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@chakra-ui/react": "^3.20.0",
|
|
46
|
+
"@emotion/react": "^11.14.0",
|
|
47
|
+
"@emotion/styled": "^11.14.0",
|
|
48
|
+
"chart.js": "^4.4.9",
|
|
49
|
+
"framer-motion": "^12.16.0",
|
|
50
|
+
"next-themes": "^0.4.6",
|
|
51
|
+
"react": "^18.3.1",
|
|
52
|
+
"react-chartjs-2": "^5.3.0",
|
|
53
|
+
"react-dom": "^18.3.1",
|
|
54
|
+
"react-icons": "^5.5.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@chromatic-com/storybook": "^4.0.0",
|
|
58
|
+
"@storybook/addon-a11y": "^9.0.5",
|
|
59
|
+
"@storybook/addon-docs": "^9.0.5",
|
|
60
|
+
"@storybook/addon-onboarding": "^9.0.5",
|
|
61
|
+
"@storybook/addon-vitest": "^9.0.5",
|
|
62
|
+
"@storybook/react-vite": "^9.0.5",
|
|
63
|
+
"@types/node": "^22.8.1",
|
|
64
|
+
"@types/react": "^18.3.12",
|
|
65
|
+
"@types/react-dom": "^18.3.1",
|
|
66
|
+
"@typescript-eslint/eslint-plugin": "^8.11.0",
|
|
67
|
+
"@typescript-eslint/parser": "^8.11.0",
|
|
68
|
+
"@vitejs/plugin-react": "^4.3.3",
|
|
69
|
+
"@vitest/browser": "^3.2.2",
|
|
70
|
+
"@vitest/coverage-v8": "^3.2.2",
|
|
71
|
+
"dts-bundle-generator": "^9.5.1",
|
|
72
|
+
"eslint": "^9.13.0",
|
|
73
|
+
"eslint-config-prettier": "^9.1.0",
|
|
74
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
75
|
+
"eslint-plugin-storybook": "^9.0.5",
|
|
76
|
+
"gh-pages": "^6.3.0",
|
|
77
|
+
"playwright": "^1.52.0",
|
|
78
|
+
"prettier": "^3.3.3",
|
|
79
|
+
"storybook": "^9.0.5",
|
|
80
|
+
"stylelint": "^16.10.0",
|
|
81
|
+
"stylelint-config-recommended": "^14.0.1",
|
|
82
|
+
"stylelint-config-sass-guidelines": "^12.1.0",
|
|
83
|
+
"tslib": "^2.8.0",
|
|
84
|
+
"typescript": "^5.6.3",
|
|
85
|
+
"vite": "^5.4.10",
|
|
86
|
+
"vite-plugin-dts": "^4.3.0",
|
|
87
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
88
|
+
"vitest": "^3.2.2"
|
|
89
|
+
},
|
|
90
|
+
"eslintConfig": {
|
|
91
|
+
"extends": [
|
|
92
|
+
"plugin:storybook/recommended"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
}
|