All Projects → ayamflow → schlick-curve

ayamflow / schlick-curve

Licence: MIT license
Schlick's fast Bias & Gain function for custom easing

Programming Languages

javascript
184084 projects - #8 most used programming language

Schlick's fast Bias Gain function

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.

Installation

npm i ayamflow/schlick-curve -S

Usage

import curve from 'schlick-curve'

function update) {
    let ease = curve(animation.progress, slope, threshold)
    camera.position.x = lerp(start, end, ease)
}

slope

  • 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)

threshold

  • 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

See also

https://iquilezles.org/www/articles/functions/functions.htm

http://c0de517e.blogspot.com/2014/04/smoothen-your-functions.html

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].