공식 홈페이지 : https://www.react-spring.dev/docs/getting-started
내 gitHub : https://github.com/leeyulgok/yulgok-page
import { useSpring, animated } from "react-spring";
const Microphone = ({ listening }) => {
const pulse = useSpring({
from: { backgroundColor: "transparent" },
to: async (next) => {
while (listening) {
await next({ backgroundColor: "rgba(0, 0, 255, 0.5)" });
await next({ backgroundColor: "transparent" });
}
},
config: { duration: 1000 },
});
return (
<animated.div style={{ ...pulse, borderRadius: '50%', width: '1.5rem', height: '1.5rem', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<svg
xmlns="http://www.w3.org/2000/svg"
height="1em"
viewBox="0 0 384 512"
cursor={"pointer"}
>
<path d="path" />
</svg>
</animated.div>
);
};
export default Microphone;