"use client" import { Container, Sprite, Stage, Text, useTick } from "@pixi/react" import { Application } from "pixi.js" import React, { useEffect, useState } from "react" const RotatingBunny = (props: any) => { const [rotation, setRotation] = useState(0) useTick((delta) => delta && setRotation(rotation + 0.0 * delta)) useEffect(() => { // Clean up event listener return () => {} }, []) return ( ) } const PixiApp = (props: any) => { // Initialize position state const [position, setPosition] = useState({ x: 0, y: 0 }) const move = (direction: string | undefined) => { switch (direction) { case "left": // Move left setPosition((prevPosition) => ({ ...prevPosition, x: prevPosition.x - 50, })) break case "right": // Move right setPosition((prevPosition) => ({ ...prevPosition, x: prevPosition.x + 50, })) break case "up": // Move left setPosition((prevPosition) => ({ ...prevPosition, y: prevPosition.y - 50, })) break case "down": // Move right setPosition((prevPosition) => ({ ...prevPosition, y: prevPosition.y + 50, })) break default: break } } const [apptext, setext] = useState("hello") useEffect(() => { // Start moving the circle according to the directions array console.log("rerun") let index = 0 function processDirections() { // To keep track of the current direction if (index < props.directions.length) { move(props.directions[index]) index++ setTimeout(processDirections, 500) // Adjust delay as needed } } processDirections() // Clean up event listener return () => {} }, [props.directions]) //reset const originalPosition = { x: props.width / 2, y: props.height - 30 } // State to hold the current position of the sprite const [spritePosition, setSpritePosition] = useState(originalPosition) // Function to reset the position of the sprite to the original position const resetSpritePosition = () => { setSpritePosition(originalPosition) } return ( <> ) } export default PixiApp