diff --git a/.DS_Store b/.DS_Store index 3b497b8c..d2bb5288 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/components/Content/Assets/PlanetCharacter.tsx b/components/Content/Assets/PlanetCharacter.tsx new file mode 100644 index 00000000..5440d4db --- /dev/null +++ b/components/Content/Assets/PlanetCharacter.tsx @@ -0,0 +1,41 @@ +import React, { useEffect, useState } from 'react'; +import Image from 'next/image'; + +const PlanetCharacter: React.FC = () => { + const [angle, setAngle] = useState(0); + // State to store animation direction (1 for right, -1 for left) + const [direction, setDirection] = useState(1); + + // Function to update animation angle and direction + const updateAnimation = () => { + // Increment angle based on direction + const newAngle = angle + 1 * direction; + // Change direction when angle reaches certain limits + if (newAngle >= 10 || newAngle <= -10) { + setDirection(direction * -1); + } + // Update angle + setAngle(newAngle); + }; + + // Update animation angle every 50 milliseconds + useEffect(() => { + const interval = setInterval(updateAnimation, 50); + return () => clearInterval(interval); // Cleanup interval on unmount + }, [angle, direction]); + + return ( +
+ Character +
+ ); +}; + +export default PlanetCharacter; \ No newline at end of file diff --git a/pages/index.tsx b/pages/index.tsx index 8537d299..a08680f1 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -22,6 +22,7 @@ import Navigation, { import { GardenDashboard } from "../components/garden-dashboard"; import FeedOverlay from "../components/Overlays/1-Feed"; import UponSignupModal from "../components/Modals/UponSignup"; +import PlanetCharacter from "../components/Content/Assets/PlanetCharacter"; export const metadata: Metadata = { title: "Star Sailors", @@ -56,7 +57,7 @@ export function PublicLanding() {