tapers
Map values between [0;1] to [X,Y] with various curves.
Featured Tapers
Installation
$ yarn add tapers# or $ npm i tapers
Documentation
Linear Taper
Implements an affine function a * x + b
.
taper.map0 // => 3taper.map05 // => 4taper.map1 // => 5
Piecewise Linear Taper
Given an array of Y values, interpolate linearily between those points.
taper.map0 // => 3taper.map05 // => 3.5taper.map1 // => 12
S-Curve Taper
A [0;1] to [0;1] mapping curve with 3 inflexion points (y === x): 0, 1 and 0.5, with a configurable S-shape bend.
taper.map0 // => 0taper.map025 // => 0.1taper.map05 // => 0.5taper.map075 // => 0. 9taper.map1 // => 1
See this taper in action on Desmos :
License
MIT - Made with ❤️ by François Best.