linear-interpolation
v2.1.1arrow_drop_downv2.1.1
v2.1.0
v2.0.9
v2.0.8
v2.0.6
v2.0.5
v2.0.1
v1.1.1
v1.1.0
v1.0.8
v1.0.5
v1.0.4
v1.0.3
STATUS
Passing
DOWNLOADS
1,332
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
529 B
Linearly interpolates between two values using the formula: (min + max - min) * amount.
1 contributor
Like
Install linear-interpolation as a package?
Copied
npm i @bit/joshk.jotils.linear-interpolation
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example modifieddraftmodifieddraft
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
and packages in Bit or NPM to the example. any of the 1 million componentstoggle layout
No preview available
No preview available
chevron_left
chevron_right
linearInterpolation (
min:
number
,max:
number
,amount:
) : number
number
Linearly interpolates between two values using the formula: (min + max - min) * amount. Passing amount a value of 0 will cause min to be returned, passing 1 will cause max to be returned. Trying to pass an amount greater than 1 or lesser than 0 will return.
Examples
Arguments
min:
number
Source value.
max:
number
Destination value.
amount:
number
Value between 0 - 1.
Returns
number
Interpolated value.
Test Summary
linearInterpolation Linearly interpolates between two values using the formula: (min + max - min) * amount | Pass |