Skip to content

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

License

Notifications You must be signed in to change notification settings

dmnsgn/inverse-lerp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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

Param Type Description
a number Start
b number End
v number Value

License

MIT. See license file.

About

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

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published