earthtoday-react-motion
Version:
A spring that solves your animation problems.
17 lines (14 loc) • 491 B
JavaScript
/* @flow */
// turn {x: {val: 1, stiffness: 1, damping: 2}, y: 2} generated by
// `{x: spring(1, {stiffness: 1, damping: 2}), y: 2}` into {x: 1, y: 2}
import type { Style, PlainStyle } from './Types';
export default function stripStyle(style: Style): PlainStyle {
let ret = {};
for (const key in style) {
if (!Object.prototype.hasOwnProperty.call(style, key)) {
continue;
}
ret[key] = typeof style[key] === 'number' ? style[key] : style[key].val;
}
return ret;
}