aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.mjs')
-rw-r--r--src/utils.mjs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/utils.mjs b/src/utils.mjs
index dba023a..d408b3d 100644
--- a/src/utils.mjs
+++ b/src/utils.mjs
@@ -39,7 +39,7 @@ export const animateRectTransition = (element, rect, options = {}) => {
39 width: w2, 39 width: w2,
40 height: h2, 40 height: h2,
41 left: x2, 41 left: x2,
42 top: y2 42 top: y2,
43 } = element.getBoundingClientRect() 43 } = element.getBoundingClientRect()
44 44
45 const rw = (w1 ?? w2) / w2 45 const rw = (w1 ?? w2) / w2
@@ -55,13 +55,13 @@ export const animateRectTransition = (element, rect, options = {}) => {
55 const transform2 = `translate(${dx}px, ${dy}px) scale(${rw}, ${rh})` 55 const transform2 = `translate(${dx}px, ${dy}px) scale(${rw}, ${rh})`
56 const keyframes = [ 56 const keyframes = [
57 { transform: transform1, opacity: 1 }, 57 { transform: transform1, opacity: 1 },
58 { transform: transform2, opacity: 0.3 } 58 { transform: transform2, opacity: 0.3 },
59 ] 59 ]
60 if (options.resume === true) keyframes.reverse() 60 if (options.resume === true) keyframes.reverse()
61 61
62 return element.animate(keyframes, { 62 return element.animate(keyframes, {
63 duration: options.duration ?? 500, 63 duration: options.duration ?? 500,
64 easing: 'ease-in-out' 64 easing: 'ease-in-out',
65 }) 65 })
66} 66}
67 67
@@ -81,7 +81,7 @@ export function throttle (func, delay) {
81 81
82 timerFlag = setTimeout( 82 timerFlag = setTimeout(
83 () => (timerFlag = null), 83 () => (timerFlag = null),
84 typeof delay === 'function' ? delay.call(context) : delay 84 typeof delay === 'function' ? delay.call(context) : delay,
85 ) 85 )
86 86
87 return func.call(context, ...args) 87 return func.call(context, ...args)