earthtoday-react-motion
Version:
A spring that solves your animation problems.
23 lines (22 loc) • 769 B
JavaScript
;
exports.__esModule = true;
exports["default"] = shouldStopAnimation;
// usage assumption: currentStyle values have already been rendered but it says
// nothing of whether currentStyle is stale (see unreadPropStyle)
function shouldStopAnimation(currentStyle, style, currentVelocity) {
for (var key in style) {
if (!Object.prototype.hasOwnProperty.call(style, key)) {
continue;
}
if (currentVelocity[key] !== 0) {
return false;
}
var styleValue = typeof style[key] === 'number' ? style[key] : style[key].val;
// stepper will have already taken care of rounding precision errors, so
// won't have such thing as 0.9999 !=== 1
if (currentStyle[key] !== styleValue) {
return false;
}
}
return true;
}