Skip to content

Commit 2fdb9e4

Browse files
Update src/runtime/animate/index.ts
incorporate the suggested change from @Conduitry Co-authored-by: Conduitry <git@chor.date>
1 parent b0d6d4e commit 2fdb9e4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/runtime/animate/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,8 @@ export function flip(node: Element, { from, to }: { from: DOMRect; to: DOMRect }
2121
const transform = style.transform === 'none' ? '' : style.transform;
2222

2323
const [ox, oy] = style.transformOrigin.split(' ').map(parseFloat);
24-
const scale = {
25-
x: to.width / node.clientWidth,
26-
y: to.height / node.clientHeight
27-
};
28-
const dx = ((from.left / scale.x) + (from.width / scale.x) * ox / (to.width / scale.x)) - ((to.left / scale.x) + ox);
29-
const dy = ((from.top / scale.y) + (from.height / scale.y) * oy / (to.height / scale.y)) - ((to.top / scale.y) + oy);
24+
const dx = ((from.left - to.left) * node.clientWidth + from.width * ox) / to.width - ox;
25+
const dy = ((from.top - to.top) * node.clientHeight + from.height * oy) / to.height - oy;
3026

3127
const {
3228
delay = 0,

0 commit comments

Comments
 (0)