"use client"; import { Mesh } from "three"; import { useEffect, useRef } from "react"; import { Canvas, useLoader, useFrame } from "@react-three/fiber"; import * as THREE from "three"; import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js"; import styles from "./skeleton.module.css"; import { appendFile } from "fs"; import { MaterialReferenceNode, positionGeometry, } from "three/examples/jsm/nodes/Nodes.js"; import { OrbitControls, useScroll } from "@react-three/drei"; function SkeletonMesh() { const mesh = useRef(null!); let head = useLoader(GLTFLoader, "/models/skeleton/head.gltf"); const eye = useLoader(GLTFLoader, "/models/skeleton/eye.gltf"); const eye2 = useLoader(GLTFLoader, "/models/skeleton/eye.gltf"); const body = useLoader(GLTFLoader, "/models/skeleton/body.gltf"); return ( ); } export default function Skeleton() { let cameraPosition = 0; const meshArray: Array<{ x: number; y: number; z: number }> = []; const starNumber = Math.floor(Math.random() * 300) + 200; for (var i = 0; i < starNumber; i++) { meshArray.push({ x: Math.random() * (-50 + 100) - 100, y: Math.random() * (50 + 50) - 50, z: Math.random() * (100 + 100) - 100, }); } return ( { cameraPosition += 1; }} className={styles.Canvas} camera={{ position: [0, 1.2, cameraPosition], rotation: [0, THREE.MathUtils.degToRad(90), 0], }} > {/* */} {meshArray.map((el) => { return ( ); })} ); }