Skip to content

Schlick's fast Bias & Gain function for custom easing

License

Notifications You must be signed in to change notification settings

ayamflow/schlick-curve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Schlick's fast Bias & Gain function for custom easing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published