1. interpolate-all
Interpolate between Numbers, Arrays or Objects
interpolate-all
Package: interpolate-all
Created by: KeeVeeG
Last modified: Fri, 06 May 2022 01:06:40 GMT
Version: 1.0.1
License: ISC
Downloads: 441
Repository: https://github.com/KeeVeeG/interpolate

Install

npm install interpolate-all
yarn add interpolate-all

Installation

 $ npm install --save interpolate-all

Import

 import interpolate from "interpolate-all"

Syntax

 interpolate(
  a: number | number[] | object,
  b: number | number[] | object,
  alpha: number,
  type: string = "linear"
): number | number[] | object

Examples

 //Number and Number
interpolate(0, 10, 0.6) // 6
 //Array and Number
interpolate([0, 10], 100, 0.5) // [50, 55]
 //Array and Array
interpolate([0, 10], [10, -2], 0.5) // [5, 4]
 //Object and Number
interpolate({foo: 0, bar: 200}, 100, 0.5) // {foo: 50, bar: 150}
 //Object and Object
interpolate({foo: 0, baz: 33, bar: 200}, {foo: 100, bar: 300}, 0.5) // {foo: 50, baz: 33, bar: 250}
interpolate({foo: 0, bar: 200}, {foo: 100, baz: 33, bar: 300}, 0.5) // {foo: 50, bar: 250}

Custom types

 interpolate(0,10,0.7,"easeInOutExpo") // 9.6875 

image

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin