Update src/runtime/animate/index.ts

incorporate the suggested change from @conduitry

Co-authored-by: Conduitry <git@chor.date>
pull/7207/head
Simon Goellner 5 years ago committed by simeydotme
parent 385737ad9f
commit 546d09dd82

@ -21,12 +21,8 @@ export function flip(node: Element, { from, to }: { from: DOMRect; to: DOMRect }
const transform = style.transform === 'none' ? '' : style.transform; const transform = style.transform === 'none' ? '' : style.transform;
const [ox, oy] = style.transformOrigin.split(' ').map(parseFloat); const [ox, oy] = style.transformOrigin.split(' ').map(parseFloat);
const scale = { const dx = ((from.left - to.left) * node.clientWidth + from.width * ox) / to.width - ox;
x: to.width / node.clientWidth, const dy = ((from.top - to.top) * node.clientHeight + from.height * oy) / to.height - oy;
y: to.height / node.clientHeight
};
const dx = ((from.left / scale.x) + (from.width / scale.x) * ox / (to.width / scale.x)) - ((to.left / scale.x) + ox);
const dy = ((from.top / scale.y) + (from.height / scale.y) * oy / (to.height / scale.y)) - ((to.top / scale.y) + oy);
const { const {
delay = 0, delay = 0,

Loading…
Cancel
Save