From 61568025fe483d3397373c7dead0b53704433083 Mon Sep 17 00:00:00 2001 From: --global <--global> Date: Thu, 30 Jan 2025 23:51:23 +0900 Subject: [PATCH] a --- app/app.css | 4 ++-- app/components/Top.tsx | 35 ----------------------------------- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/app/app.css b/app/app.css index b7d87b9..d7c066a 100644 --- a/app/app.css +++ b/app/app.css @@ -52,9 +52,9 @@ body { @keyframes rotate { 0% { - transform: rotate(var(--rotate-angle, 0deg)); + transform: rotate(0deg); } 100% { - transform: rotate(calc(var(--rotate-angle, 0deg) + 360deg)); + transform: rotate(360deg); } } diff --git a/app/components/Top.tsx b/app/components/Top.tsx index 4f68248..bff8f24 100644 --- a/app/components/Top.tsx +++ b/app/components/Top.tsx @@ -1,36 +1,8 @@ import React, { useState, useRef } from "react"; export default function Top() { - const [angle, setAngle] = useState(0); const avatarRef = useRef(null); // Ref 타입 변경 - const handleMouseEnter = () => { - if (avatarRef.current) { - avatarRef.current.style.animation = `rotate 1s linear infinite`; - } - }; - - const handleMouseLeave = () => { - if (avatarRef.current) { - const computedStyle = window.getComputedStyle(avatarRef.current); - const matrix = computedStyle.transform; - - if (matrix && matrix !== "none") { - const values = matrix.match(/matrix\((.+)\)/)?.[1].split(", "); - if (values) { - const a = parseFloat(values[0]); - const b = parseFloat(values[1]); - const currentAngle = Math.round(Math.atan2(b, a) * (180 / Math.PI)); - setAngle((prev) => - currentAngle >= 0 ? currentAngle : currentAngle + 360 - ); - } - } - avatarRef.current.style.animation = "none"; - avatarRef.current.style.transform = `rotate(${angle}deg)`; - } - }; - return (