import { useFrame } from "@react-three/fiber";
import { useRef } from "react";

export function useAnimationClock(callback: (dt: number, elapsed: number) => void) {
  const elapsedRef = useRef(0);
  useFrame((_, dt) => {
    elapsedRef.current += dt;
    callback(dt, elapsedRef.current);
  });
}
