fix
This commit is contained in:
parent
61f516f3ce
commit
462e851aab
@ -53,13 +53,13 @@ export function Galaxy(props: JSX.IntrinsicElements['group']) {
|
|||||||
|
|
||||||
return [positions, colors]
|
return [positions, colors]
|
||||||
}, [nodes])
|
}, [nodes])
|
||||||
//const starTexture = useLoader(THREE.TextureLoader, '/star.png')
|
|
||||||
|
|
||||||
// slowly rotate the galaxy
|
// slowly rotate the galaxy
|
||||||
useFrame(({ clock }) => {
|
useFrame(({ clock }) => {
|
||||||
ref.current.rotation.z = clock.getElapsedTime() / 2
|
ref.current.rotation.z = clock.getElapsedTime() / 2
|
||||||
// zoom in and out
|
// zoom in and out
|
||||||
ref.current.scale.setScalar(Math.sin(clock.getElapsedTime() / 2) + 1.5)
|
ref.current.scale.setScalar(Math.sin(clock.getElapsedTime() / 2) + 1.2)
|
||||||
})
|
})
|
||||||
|
|
||||||
// make particles glow
|
// make particles glow
|
||||||
@ -90,6 +90,7 @@ export function Galaxy(props: JSX.IntrinsicElements['group']) {
|
|||||||
lights={[galaxyCenterLightRef]}
|
lights={[galaxyCenterLightRef]}
|
||||||
/>
|
/>
|
||||||
</EffectComposer>
|
</EffectComposer>
|
||||||
|
<ambientLight intensity={1} />
|
||||||
</group>
|
</group>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -100,11 +101,10 @@ export const ThreeFiberGalaxy = () => {
|
|||||||
return (
|
return (
|
||||||
<Canvas camera={{ position: [0, 12, 0], fov: 75 }}>
|
<Canvas camera={{ position: [0, 12, 0], fov: 75 }}>
|
||||||
<OrbitControls enableZoom={true} enablePan={true} enableRotate={true} zoomSpeed={2} panSpeed={2} rotateSpeed={0.5} />
|
<OrbitControls enableZoom={true} enablePan={true} enableRotate={true} zoomSpeed={2} panSpeed={2} rotateSpeed={0.5} />
|
||||||
<ambientLight />
|
|
||||||
<pointLight position={[10, 10, 10]} />
|
<pointLight position={[10, 10, 10]} />
|
||||||
<ScrollControls pages={5}>
|
<ScrollControls pages={5}>
|
||||||
<Scroll>
|
<Scroll>
|
||||||
<Galaxy position={[0, 0, 0]} />
|
<Galaxy position={[0, 9, 0]} />
|
||||||
</Scroll>
|
</Scroll>
|
||||||
</ScrollControls>
|
</ScrollControls>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
Loading…
Reference in New Issue
Block a user