JSPM

interpolation-arrays

0.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q26545F
  • License MIT

Interpolation between many values

Package Exports

  • interpolation-arrays

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (interpolation-arrays) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

interpolation-arrays

This module will interpolate between many values in an Array.

Example:

var numberValuesToInterpolate = [ 0, 1, 2 ];

var arrayPointValuesToInterpolate = [  
                                        [ 0, 0 ], 
                                        [ 1, 1 ], 
                                        [ 2, 2 ] 
                                    ];

var objectPointValuesToInterpolate = [  
                                        { x: 0, y: 0 }, 
                                        { x: 1, y: 1 }, 
                                        { x: 2, y: 2 } 
                                    ];

var numberInterpolate = require( '../index' )( numberValuesToInterpolate );
var arrayPointInterpolate = require( '../index' )( arrayPointValuesToInterpolate );
var objectPointValuesToInterpolate = require( '../index' )( objectPointValuesToInterpolate );


console.log( numberInterpolate( 0.5 ) ); // 1
console.log( numberInterpolate( 0.75 ) ); // 1.5

console.log( arrayPointInterpolate( 0.5 ) ); // [ 1, 1 ]
console.log( arrayPointInterpolate( 0.75 ) ); // [ 1.5, 1.5 ]

console.log( objectPointValuesToInterpolate( 0.5 ) ); // { x: 1, y: 1 }
console.log( objectPointValuesToInterpolate( 0.75 ) ); // { x: 1.5, y: 1.5 }