feat/add-three.js #3
BIN
public/gear.glb
BIN
public/gear.glb
Binary file not shown.
|
@ -1,7 +1,8 @@
|
|||
import { Canvas, useFrame, useLoader } from '@react-three/fiber';
|
||||
import { Clone, ContactShadows, OrbitControls } from '@react-three/drei'
|
||||
import { Circle, Clone, ContactShadows, OrbitControls } from '@react-three/drei'
|
||||
import { Suspense, useRef } from 'react';
|
||||
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
||||
import { AmbientLight } from 'three';
|
||||
|
||||
function Gear(props: any) {
|
||||
const gltf = useLoader(GLTFLoader, './gear.glb');
|
||||
|
@ -27,6 +28,8 @@ function Renderer() {
|
|||
<div className='flex flex-col h-screen gradient'>
|
||||
<Canvas camera={{ position: [-8, 5, 8] }}>
|
||||
<Suspense fallback={null}>
|
||||
<ambientLight />
|
||||
<directionalLight />
|
||||
<Gear />
|
||||
<ContactShadows
|
||||
scale={60}
|
||||
|
@ -35,7 +38,10 @@ function Renderer() {
|
|||
blur={2}
|
||||
resolution={512}
|
||||
/>
|
||||
<OrbitControls target={[0, 0, 0]} maxPolarAngle={Math.PI / 2} />
|
||||
<Circle args={[10]} position={[0,-2.001,0]} rotation-x={-Math.PI / 2} receiveShadow>
|
||||
<meshBasicMaterial color={[0.8,0.8,0.8]}/>
|
||||
</Circle>
|
||||
<OrbitControls target={[0, 0, 0]} maxPolarAngle={Math.PI / 2.0} />
|
||||
</Suspense>
|
||||
</Canvas>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue