After the skeletal animation appears, the click event bound to React cannot be triggered. I want to implement a click event at a certain position in the image to change the animation mode
const SpineAnimation = () => {
const containerRef = useRef(null);
useEffect(() => {
if (containerRef.current) {
const spinePlayer = new SpinePlayer(containerRef.current, {
jsonUrl: "https://i1.branchcn.com/static/skeleton.json",
atlas: "https://i1.branchcn.com/static/skeleton.atlas",
backgroundColor: '#00000000',
preserveDrawingBuffer: true,
animation: "animation",
showControls: false,
showLoading: false,
alpha: true,
});
return () => {
spinePlayer && spinePlayer.dispose();
};
}
}, []);
return (
<div ref={containerRef}
onClick={() => {
console.log(1)
}}></div>
);
};
export default SpineAnimation;