()
| 259 | }); |
| 260 | |
| 261 | const leaveHandler = () => { |
| 262 | gsap.ticker.remove(tickerFnRef.current); |
| 263 | isActiveRef.current = false; |
| 264 | targetCornerPositionsRef.current = null; |
| 265 | gsap.set(activeStrengthRef, { current: 0, overwrite: true }); |
| 266 | activeTarget = null; |
| 267 | |
| 268 | if (cursorColorOnTarget && cornersRef.current) { |
| 269 | gsap.to(Array.from(cornersRef.current), { |
| 270 | borderColor: cursorColor, |
| 271 | duration: 0.15, |
| 272 | ease: 'power2.out' |
| 273 | }); |
| 274 | if (dotRef.current) { |
| 275 | gsap.to(dotRef.current, { |
| 276 | backgroundColor: cursorColor, |
| 277 | duration: 0.15, |
| 278 | ease: 'power2.out' |
| 279 | }); |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | if (cornersRef.current) { |
| 284 | const corners = Array.from(cornersRef.current); |
| 285 | gsap.killTweensOf(corners, 'x,y'); |
| 286 | const { cornerSize } = constants; |
| 287 | const positions = [ |
| 288 | { x: -cornerSize * 1.5, y: -cornerSize * 1.5 }, |
| 289 | { x: cornerSize * 0.5, y: -cornerSize * 1.5 }, |
| 290 | { x: cornerSize * 0.5, y: cornerSize * 0.5 }, |
| 291 | { x: -cornerSize * 1.5, y: cornerSize * 0.5 } |
| 292 | ]; |
| 293 | const tl = gsap.timeline(); |
| 294 | corners.forEach((corner, index) => { |
| 295 | tl.to(corner, { x: positions[index].x, y: positions[index].y, duration: 0.3, ease: 'power3.out' }, 0); |
| 296 | }); |
| 297 | } |
| 298 | resumeTimeout = setTimeout(() => { |
| 299 | if (!activeTarget && cursorRef.current && spinTl.current) { |
| 300 | const currentRotation = gsap.getProperty(cursorRef.current, 'rotation'); |
| 301 | const normalizedRotation = currentRotation % 360; |
| 302 | spinTl.current.kill(); |
| 303 | spinTl.current = gsap |
| 304 | .timeline({ repeat: -1 }) |
| 305 | .to(cursorRef.current, { rotation: '+=360', duration: spinDuration, ease: 'none' }); |
| 306 | gsap.to(cursorRef.current, { |
| 307 | rotation: normalizedRotation + 360, |
| 308 | duration: spinDuration * (1 - normalizedRotation / 360), |
| 309 | ease: 'none', |
| 310 | onComplete: () => { |
| 311 | spinTl.current?.restart(); |
| 312 | } |
| 313 | }); |
| 314 | } |
| 315 | resumeTimeout = null; |
| 316 | }, 50); |
| 317 | cleanupTarget(target); |
| 318 | }; |
nothing calls this directly
no test coverage detected