aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils.mjs
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-10-08 17:33:26 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-10-09 14:52:19 +0800
commit9e62f0371f66cc4f2aa275f958f16a9443b108b7 (patch)
tree41580b2b047eff59dc37b2fe935789d36a0c4654 /src/utils.mjs
parent551c5c3fbe7163bc78e5159ddbc57967a0299e4e (diff)
chore: apply standardjs with trailing comma
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)