1.0.1 • Published 1 year ago

inverse-lerp v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

inverse-lerp

npm version stability-stable npm minzipped size dependencies types Conventional Commits styled with prettier linted with eslint license

Get a value's interpolant within a linear range, effectively remapping a value v within a, b to 0, 1.

paypal coinbase twitter

npm.io

Installation

npm install inverse-lerp

Usage

import inverseLerp from "inverse-lerp";

const range = [20, 40];
const [a, b] = range;
const value = 30;
const t = inverseLerp(a, b, value);
// => 0.5

API

inverseLerp

inverseLerp(a, b, v) ⇒ number

Get a value's interpolant within a linear range, effectively remapping a value v within a, b to 0, 1.

Kind: Exported function

ParamTypeDescription
anumberStart
bnumberEnd
vnumberValue

License

MIT. See license file.

1.0.1

1 year ago

1.0.0

1 year ago