"use client";
import { useMotionValue, useAnimationFrame } from "framer-motion";

export function useFloatingAnimation(amplitude = 8, speed = 0.6, phase = 0) {
  const y = useMotionValue(0);
  const x = useMotionValue(0);

  useAnimationFrame((t) => {
    const s = t / 1000;
    y.set(Math.sin(s * speed + phase) * amplitude);
    x.set(Math.cos(s * speed * 0.7 + phase) * (amplitude * 0.4));
  });

  return { x, y };
}
