UNPKG
@kaliber/math
Version:
latest (1.1.3)
1.1.3
1.1.2
1.1.1
1.1.0
1.0.0
Math utilities
kaliberjs/math
@kaliber/math
/
src
/
lerp.js
9 lines
(7 loc)
•
235 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
import
{ clamp as _clamp } from './clamp'
export
function lerp
(
{
start
,
end
, input, clamp = false }
)
{ const
result
=
start
+
(
end
-
start
)
* input
return
clamp ? _clamp
(
{ min:
start
, max:
end
, input:
result
}
)
:
result
}