11const heroAnimation = async ( ) => {
2- const isReduceMotionEnabled = window . matchMedia ( '(prefers-reduced-motion: reduce)' ) . matches ;
2+ const isReduceMotionEnabled = window . matchMedia (
3+ '(prefers-reduced-motion: reduce)' ,
4+ ) . matches
35 const urlParams = new URLSearchParams ( location . search )
46 const hasDebugParam = urlParams . has ( 'debug' )
57
@@ -118,7 +120,12 @@ const heroAnimation = async () => {
118120 return { ctx, pathInstance }
119121 }
120122
121- const initLogo = ( { canvas, image, positionStart : [ posX , posY ] , positionEnd : [ endX , endY ] } ) => {
123+ const initLogo = ( {
124+ canvas,
125+ image,
126+ positionStart : [ posX , posY ] ,
127+ positionEnd : [ endX , endY ] ,
128+ } ) => {
122129 const ctx = canvas . getContext ( '2d' )
123130 // Same reason for conversion as initSwoops
124131 ctx . translate ( posX - image . naturalWidth / 2 , posY - image . naturalHeight / 2 )
@@ -128,9 +135,9 @@ const heroAnimation = async () => {
128135 ctx . drawImage ( image , 0 , 0 )
129136 } else {
130137 ctx . globalAlpha = 1
131- const deltaX = endX - posX ;
132- const deltaY = endY - posY ;
133- ctx . drawImage ( image , deltaX , deltaY ) ;
138+ const deltaX = endX - posX
139+ const deltaY = endY - posY
140+ ctx . drawImage ( image , deltaX , deltaY )
134141 }
135142
136143 return ctx
@@ -147,11 +154,11 @@ const heroAnimation = async () => {
147154 logo . image = logoImage
148155 // init canvas for each swoop layer
149156 heroSwoops . forEach ( ( swoop , i ) => {
150- swoop . image = swoopImages [ i ] ;
151- const canvasData = initSwoops ( swoop ) ;
152- swoop . ctx = canvasData . ctx ;
153- swoop . pathInstance = canvasData . pathInstance ;
154- } ) ;
157+ swoop . image = swoopImages [ i ]
158+ const canvasData = initSwoops ( swoop )
159+ swoop . ctx = canvasData . ctx
160+ swoop . pathInstance = canvasData . pathInstance
161+ } )
155162 // init logo canvas
156163 logo . ctx = initLogo ( logo )
157164 } catch ( error ) {
@@ -160,7 +167,7 @@ const heroAnimation = async () => {
160167 }
161168
162169 if ( isReduceMotionEnabled ) {
163- return ;
170+ return
164171 }
165172
166173 const DURATION = 1000
@@ -271,7 +278,7 @@ const heroAnimation = async () => {
271278 logo . state ,
272279 {
273280 ease : 'out(1.1)' ,
274- duration : 250 ,
281+ duration : 200 ,
275282 delay : 750 ,
276283 progress : 1 ,
277284 // ease: 'inOutQuad',
0 commit comments