Skip to content
Transform [0;1] <=> [X,Y] values with custom curves
TypeScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
img
src
website
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
nodemon.json
package.json
tsconfig.json
yarn.lock

README.md

tapers

NPM MIT License Travis CI Build Dependabot Status Average issue resolution time Number of open issues

Map values between [0;1] to [X,Y] with various curves.

Check out the Demo website.

Featured Tapers

Installation

$ yarn add tapers
# or
$ npm i tapers

Documentation

Linear Taper

Implements an affine function a * x + b.

import { LinearTaper } from 'tapers'

const taper = new LinearTaper(3, 5)
taper.map(0) // => 3
taper.map(0.5) // => 4
taper.map(1) // => 5

Piecewise Linear Taper

Given an array of Y values, interpolate linearily between those points.

import { PiecewiseLinearTaper } from 'tapers'

const taper = new PiecewiseLinearTaper([3, 5, 2, 12])
taper.map(0) // => 3
taper.map(0.5) // => 3.5
taper.map(1) // => 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.

import { SCurveTaper } from 'tapers'

const taper = new SCurveTaper(0.75)
taper.map(0) // => 0
taper.map(0.25) // => 0.1
taper.map(0.5) // => 0.5
taper.map(0.75) // => 0. 9
taper.map(1) // => 1

See this taper in action on Desmos :

S-Curve taper

License

MIT - Made with ❤️ by François Best.

You can’t perform that action at this time.