UNPKG

popmotion

Version:

The animator's toolbox

18 lines 682 B
import { smoothFrame } from './smooth-frame'; import { getFrameData } from 'framesync'; export var smooth = function (strength) { if (strength === void 0) { strength = 50; } var previousValue = 0; var lastUpdated = 0; return function (v) { var currentFramestamp = getFrameData().timestamp; var timeDelta = currentFramestamp !== lastUpdated ? currentFramestamp - lastUpdated : 0; var newValue = timeDelta ? smoothFrame(previousValue, v, timeDelta, strength) : previousValue; lastUpdated = currentFramestamp; previousValue = newValue; return newValue; }; }; //# sourceMappingURL=smooth.js.map