From 1c6a62f0c55b511d31900404eed1d9cabb6850df Mon Sep 17 00:00:00 2001 From: Mike Date: Sat, 22 Jul 2023 17:09:25 +0300 Subject: [PATCH 1/2] Optimazing flip function --- packages/svelte/src/runtime/animate/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/svelte/src/runtime/animate/index.js b/packages/svelte/src/runtime/animate/index.js index d93d28e34229..7e5f38fc0bfb 100644 --- a/packages/svelte/src/runtime/animate/index.js +++ b/packages/svelte/src/runtime/animate/index.js @@ -14,7 +14,7 @@ import { is_function } from '../internal/index.js'; export function flip(node, { from, to }, params = {}) { const style = getComputedStyle(node); const transform = style.transform === 'none' ? '' : style.transform; - const [ox, oy] = style.transformOrigin.split(' ').map(parseFloat); + const {0: ox, 1: oy} = style.transformOrigin.split(' ').map(parseFloat); const dx = from.left + (from.width * ox) / to.width - (to.left + ox); const dy = from.top + (from.height * oy) / to.height - (to.top + oy); const { delay = 0, duration = (d) => Math.sqrt(d) * 120, easing = cubicOut } = params; From 71418f6a4718b1951bf420b84090f8cace2d0a83 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Wed, 26 Jul 2023 15:45:00 -0700 Subject: [PATCH 2/2] run pnpm format --- packages/svelte/src/runtime/animate/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/svelte/src/runtime/animate/index.js b/packages/svelte/src/runtime/animate/index.js index 7e5f38fc0bfb..73b621b3b941 100644 --- a/packages/svelte/src/runtime/animate/index.js +++ b/packages/svelte/src/runtime/animate/index.js @@ -14,7 +14,7 @@ import { is_function } from '../internal/index.js'; export function flip(node, { from, to }, params = {}) { const style = getComputedStyle(node); const transform = style.transform === 'none' ? '' : style.transform; - const {0: ox, 1: oy} = style.transformOrigin.split(' ').map(parseFloat); + const { 0: ox, 1: oy } = style.transformOrigin.split(' ').map(parseFloat); const dx = from.left + (from.width * ox) / to.width - (to.left + ox); const dy = from.top + (from.height * oy) / to.height - (to.top + oy); const { delay = 0, duration = (d) => Math.sqrt(d) * 120, easing = cubicOut } = params;