# @mapbox/unitbezier

> unit bezier curve interpolation

Latest version **1.0.0** (published 2026-05-26) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install @mapbox/unitbezier
pnpm add @mapbox/unitbezier
yarn add @mapbox/unitbezier
bun add @mapbox/unitbezier
```

## Health

**Score 50/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: declining downloads.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2026-05-26 |
| First published | 2017-01-17 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Maintainers | mapbox-npm-01, mapbox-npm-02, mapbox-npm-07, mapbox-npm-03, mapbox-npm-04, mapbox-npm-09, mapbox-npm-05, mapbox-npm-06, mapbox-npm-08, mapbox-npm-advanced-actions, mapbox-npm-ci, mapbox-npm, mapbox-admin, mapbox-machine-user, mbx-npm-ci-staging, mbx-npm-ci-production, mbx-npm-01-production, mbx-npm-02-production, mbx-npm-03-production, mbx-npm-04-production, mbx-npm-05-production, mbx-npm-06-production, mbx-npm-07-production, mbx-npm-08-production, mbx-npm-09-production, mbx-npm-02-staging, mbx-npm-advanced-actions-staging, mbx-npm-advanced-actions-production |
| Keywords | unit, bezier, interpolation, webkit |

## Links

- npm: https://www.npmjs.com/package/@mapbox/unitbezier
- Repository: https://github.com/mapbox/unitbezier
- Issues: https://github.com/mapbox/unitbezier/issues
- npm.io page: https://npm.io/package/@mapbox/unitbezier

## Recent versions

- 1.0.0 (latest) — 2026-05-26
- 0.0.1 — 2021-10-22
- 0.0.0 — 2017-01-17

## README

[![Node](https://github.com/mapbox/unitbezier/actions/workflows/node.yml/badge.svg)](https://github.com/mapbox/unitbezier/actions/workflows/node.yml)

# unitbezier

Unit bezier interpolation function: a port to JavaScript from Webkit:

http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/platform/graphics/UnitBezier.h

## API

```js
import unitBezier from '@mapbox/unitbezier';

const ease = unitBezier(0.25, 0.1, 0.25, 1); // CSS `ease`
ease(0.5);        // → 0.8024…
ease(0.5, 1e-8);  // tighter precision
```

### `unitBezier(p1x, p1y, p2x, p2y)`

Returns a function that evaluates the cubic bezier curve defined by control points `(0,0)`, `(p1x, p1y)`, `(p2x, p2y)`, `(1,1)`.

### `ease(x, epsilon?)`

Evaluate the curve for `x` (clamped to `[0, 1]`). `epsilon` controls solver precision (default `1e-6`).

---
_Source: https://npm.io/package/@mapbox/unitbezier · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
