curve-kit 0.0.1

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/README.md ADDED
@@ -0,0 +1,24 @@
1
+ <div align="center">
2
+
3
+ # Curve Kit
4
+
5
+ ### Small curve utilities for motion and interface animation.
6
+
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-3178c6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) [![Module](https://img.shields.io/badge/module-ESM-f7df1e?logo=javascript&logoColor=111827)](package.json) [![Status](https://img.shields.io/badge/status-in%20development-f5a623)](https://mosa.sh)
8
+
9
+ [mosa.sh](https://mosa.sh)
10
+
11
+ </div>
12
+
13
+ Curve Kit is a tiny, dependency-free home for useful motion curves. Follow
14
+ development and join the waitlist at [mosa.sh](https://mosa.sh).
15
+
16
+ ```sh
17
+ npm i curve-kit
18
+ ```
19
+
20
+ ```ts
21
+ import { cubicBezier } from "curve-kit";
22
+
23
+ cubicBezier(0.5, 0, 0.2, 0.8, 1);
24
+ ```
@@ -0,0 +1,2 @@
1
+ /** Returns the point on a cubic Bezier curve at progress from zero to one. */
2
+ export declare function cubicBezier(progress: number, start: number, control1: number, control2: number, end: number): number;
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ /** Returns the point on a cubic Bezier curve at progress from zero to one. */
2
+ export function cubicBezier(progress, start, control1, control2, end) {
3
+ if (!Number.isFinite(progress))
4
+ throw new TypeError("Progress must be a finite number.");
5
+ const t = Math.min(1, Math.max(0, progress));
6
+ const inverse = 1 - t;
7
+ return inverse ** 3 * start + 3 * inverse ** 2 * t * control1 + 3 * inverse * t ** 2 * control2 + t ** 3 * end;
8
+ }
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "curve-kit",
3
+ "version": "0.0.1",
4
+ "description": "Small curve utilities for motion and interface animation.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": { ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" } },
9
+ "files": ["dist", "README.md"],
10
+ "sideEffects": false,
11
+ "scripts": { "build": "tsc --project tsconfig.json", "prepublishOnly": "npm run build" },
12
+ "keywords": ["curve", "bezier", "animation", "motion"],
13
+ "homepage": "https://mosa.sh/motion",
14
+ "author": "Mosanic <dev@mosanic.io>",
15
+ "license": "MIT",
16
+ "engines": { "node": ">=20" },
17
+ "publishConfig": { "access": "public" },
18
+ "devDependencies": { "typescript": "^5.9.3" }
19
+ }