Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 3x 4x 4x | import { toDecimal } from './to-decimal';
/*
Framerate-independent smoothing
@param [number]: New value
@param [number]: Old value
@param [number]: Frame duration
@param [number] (optional): Smoothing (0 is none)
*/
export const smoothFrame = (
prevValue: number,
nextValue: number,
duration: number,
Ismoothing: number = 0
) =>
toDecimal(
prevValue +
(duration * (nextValue - prevValue)) / Math.max(smoothing, duration)
);
|