2021-12-08 22:43:31 +01:00
|
|
|
/**
|
|
|
|
* Perspective Interpolation Function.
|
|
|
|
*
|
|
|
|
* @param {number} a start value
|
|
|
|
* @param {number} b end value
|
|
|
|
* @param {string} u unit
|
|
|
|
* @param {number} v progress
|
|
|
|
* @returns {string} the perspective function in string format
|
|
|
|
*/
|
2021-03-30 11:23:29 +02:00
|
|
|
export default function perspective(a, b, u, v) {
|
2021-12-08 22:43:31 +01:00
|
|
|
// eslint-disable-next-line no-bitwise
|
2021-03-30 11:23:29 +02:00
|
|
|
return `perspective(${((a + (b - a) * v) * 1000 >> 0) / 1000}${u})`;
|
|
|
|
}
|