Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
12345678910111213141516171819202122232425262728293031
  1. /* @flow */
  2. import type {PlainStyle, Style, Velocity} from './Types';
  3. // usage assumption: currentStyle values have already been rendered but it says
  4. // nothing of whether currentStyle is stale (see unreadPropStyle)
  5. export default function shouldStopAnimation(
  6. currentStyle: PlainStyle,
  7. style: Style,
  8. currentVelocity: Velocity,
  9. ): boolean {
  10. for (let key in style) {
  11. if (!Object.prototype.hasOwnProperty.call(style, key)) {
  12. continue;
  13. }
  14. if (currentVelocity[key] !== 0) {
  15. return false;
  16. }
  17. const styleValue = typeof style[key] === 'number'
  18. ? style[key]
  19. : style[key].val;
  20. // stepper will have already taken care of rounding precision errors, so
  21. // won't have such thing as 0.9999 !=== 1
  22. if (currentStyle[key] !== styleValue) {
  23. return false;
  24. }
  25. }
  26. return true;
  27. }