@curiousmedia/range-finder

1.0.0 • Public • Published

Range Finder

Calculate the percentage or value between a range of numbers.

Installation

npm install @curiousmedia/range-finder

Basic usage

Instance

let rf = new RangeFinder(10, 20);

// Get percent
rf.percent(15); // 0.5

// Get value
rf.value(0.5); // 15

Static

RangeFinder.percent(15, 10, 20);

Easing

Robert Penner Equation

See easing functions NPM library.

let rf = new RangeFinder(10, 20, Easing.Quadratic.In);
rf.value(rf.ease(0.5)); // 12.5
rf.ease(rf.percent(15)); // 0.25

Configurable easing

let rf = new RangeFinder(10, 20, RangeFinder.powIn(3));
rf.value(rf.ease(0.5)); // 11.25
rf.ease(rf.percent(15)); // 0.25

Readme

Keywords

none

Package Sidebar

Install

npm i @curiousmedia/range-finder

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

13 kB

Total Files

16

Last publish

Collaborators

  • ishoa
  • cm-gregory
  • kyfoote
  • curiousjason
  • eaglstun