Schlick's fast version of Perlin's Bias and Gain functions, taken from this paper by Jonathan T. Barron. Basically enables you to craft close estimates of the Penner easing functions or come up with your own, just by tweaking 2 parameters.
Check this article for more details and great accompanying interactive demo of the function.
npm i ayamflow/schlick-curve -S
import curve from 'schlick-curve'
function update) {
let ease = curve(animation.progress, slope, threshold)
camera.position.x = lerp(start, end, ease)
}
- The curve will be straighter with
slope
closer to 1 (think linear easing) - the curve will be very sloped with
slope
closer to 0 (think exponential easing)
- A value of 0.5 will yield a curve similar to an "in out" easing
- A value close to 1 will yield an "out" easing
- A value close to 0 will yield an "in" easing
https://iquilezles.org/www/articles/functions/functions.htm
http://c0de517e.blogspot.com/2014/04/smoothen-your-functions.html