import { Canvas, useFrame, useLoader } from '@react-three/fiber'; import { Clone, ContactShadows, OrbitControls } from '@react-three/drei' import { Suspense, useRef } from 'react'; import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'; function Gear(props: any) { const gltf = useLoader(GLTFLoader, './gear.glb'); const gear1Ref = useRef() const gear2Ref = useRef() const speed = 2.5; useFrame(({ clock }) => { gear1Ref.current.rotation.z = clock.getElapsedTime() * speed + Math.sin(clock.getElapsedTime()) * speed gear2Ref.current.rotation.z = -clock.getElapsedTime() * speed - Math.sin(clock.getElapsedTime()) * speed }) return <> } function Renderer() { return (
); } export default Renderer