Allows to «animate» number values with given duration
import tween from 'tweeen';
const stop = tween(1, 100, (value) => {
console.log(value);
}, {
duration: 1000,
});Signature of tween function
type TweenParams {
duration?: number;
easing?: (t: number) => number;
fps?: number;
end?: Function;
};
function tween(
from: number,
to: number,
cb: (value: number) => void,
params?: TweenParams,
);duration— duration in ms, defaults to300easing— simple easing function that takes one argument — time (from 0 to 1). Defaults tolinear. You can use functions from eases or similar packagefps— defaults to60end— animation end callback