2021-12-08 22:43:31 +01:00
|
|
|
/**
|
|
|
|
* Array Interpolation Function.
|
|
|
|
*
|
|
|
|
* @param {number[]} a start array
|
|
|
|
* @param {number[]} b end array
|
|
|
|
* @param {number} v progress
|
|
|
|
* @returns {number[]} the resulting array
|
|
|
|
*/
|
2021-03-30 11:23:29 +02:00
|
|
|
export default function arrays(a, b, v) {
|
2021-12-08 22:43:31 +01:00
|
|
|
const result = []; const { length } = b;
|
|
|
|
for (let i = 0; i < length; i += 1) {
|
|
|
|
// eslint-disable-next-line no-bitwise
|
2021-03-30 11:23:29 +02:00
|
|
|
result[i] = ((a[i] + (b[i] - a[i]) * v) * 1000 >> 0) / 1000;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|