Adding changes
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import '../styles/styles.scss';
|
import '../styles/styles.scss';
|
||||||
import * as THREE from 'three';
|
import * as THREE from 'three';
|
||||||
import { useRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
import { Canvas, useFrame } from '@react-three/fiber';
|
import { useFrame } from '@react-three/fiber';
|
||||||
import { Text, Environment, MeshReflectorMaterial, useTexture, MeshDistortMaterial } from '@react-three/drei';
|
import { Text, Environment, MeshReflectorMaterial, useTexture, MeshDistortMaterial } from '@react-three/drei';
|
||||||
import { gsap } from 'gsap';
|
import { gsap } from 'gsap';
|
||||||
|
|
||||||
@@ -13,7 +13,6 @@ import font from '../assets/fonts/Inter-Bold.woff';
|
|||||||
const Floor = () => {
|
const Floor = () => {
|
||||||
const [floor, normal] = useTexture([floorTexture, floorTextureNormal]);
|
const [floor, normal] = useTexture([floorTexture, floorTextureNormal]);
|
||||||
return (
|
return (
|
||||||
// <MeshReflectorMaterial blur={[400, 100]} resolution={512} args={[10, 10]} mirror={0.5} mixBlur={6} mixStrength={1.5} rotation={[0, 0, 0]} color="#a0a0a0" metalness={0.4} roughnessMap={floor} normalMap={normal} normalScale={[2, 2]} />
|
|
||||||
<mesh rotation={[-Math.PI / 2, 0, 0]}>
|
<mesh rotation={[-Math.PI / 2, 0, 0]}>
|
||||||
<planeGeometry attach='geometry' args={[15, 7]} />
|
<planeGeometry attach='geometry' args={[15, 7]} />
|
||||||
<MeshReflectorMaterial
|
<MeshReflectorMaterial
|
||||||
@@ -21,12 +20,12 @@ const Floor = () => {
|
|||||||
resolution={2048}
|
resolution={2048}
|
||||||
mixBlur={6}
|
mixBlur={6}
|
||||||
mirror={1}
|
mirror={1}
|
||||||
mixStrength={0.2}
|
mixStrength={0.5}
|
||||||
roughnessMap={floor}
|
roughnessMap={floor}
|
||||||
roughness={10}
|
roughness={10}
|
||||||
metalness={0.4}
|
metalness={0.1}
|
||||||
normalMap={normal}
|
normalMap={normal}
|
||||||
normalScale={[3, 3]}
|
normalScale={[2, 2]}
|
||||||
depthScale={1.2}
|
depthScale={1.2}
|
||||||
minDepthThreshold={0.4}
|
minDepthThreshold={0.4}
|
||||||
maxDepthThreshold={1.4}
|
maxDepthThreshold={1.4}
|
||||||
@@ -37,7 +36,7 @@ const Floor = () => {
|
|||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const textRef = useRef();
|
const textRef = useRef();
|
||||||
const vec = useState(() => new THREE.Vector3());
|
const cloudRef = useRef();
|
||||||
const [video] = useState(() => {
|
const [video] = useState(() => {
|
||||||
const vid = document.createElement('video');
|
const vid = document.createElement('video');
|
||||||
vid.src = dreiVideo;
|
vid.src = dreiVideo;
|
||||||
@@ -48,26 +47,30 @@ const App = () => {
|
|||||||
return vid;
|
return vid;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const meshAnimation = () => {
|
||||||
|
gsap.to( cloudRef.current.scale, {x: "1.2", y: "1.2", z: "1.2" } );
|
||||||
|
gsap.to( cloudRef.current.position, {x: "3"} );
|
||||||
|
};
|
||||||
|
|
||||||
useFrame((state) => {
|
useFrame((state) => {
|
||||||
// state.camera.position.lerp(vec, 0.1);
|
// console.log( state );
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<color attach="background" args={["black"]} />
|
<color attach="background" args={["black"]} />
|
||||||
<fog attach="fog" args={["black", 2.8, 3.5]} />
|
<fog attach="fog" args={["black", 1, 4]} />
|
||||||
<group position={[0, -1, 0]}>
|
<group position={[0, -1, 0]}>
|
||||||
<Text
|
<Text
|
||||||
ref={textRef}
|
ref={textRef}
|
||||||
font={font}
|
font={font}
|
||||||
textAlign="center"
|
|
||||||
lineHeight={-0.8}
|
lineHeight={-0.8}
|
||||||
maxWidth={3}
|
maxWidth={3}
|
||||||
fontSize={0.75}
|
fontSize={1}
|
||||||
position={[-2, 1.2, -3.2]}
|
position={[-1.5, 1.4, -3.2]}
|
||||||
rotation={[0, 0, 0]}
|
rotation={[0, 0, 0]}
|
||||||
>
|
>
|
||||||
Designer & Developer
|
Designer and Developer
|
||||||
<meshStandardMaterial toneMapped={false}>
|
<meshStandardMaterial toneMapped={false} fog={false}>
|
||||||
<videoTexture
|
<videoTexture
|
||||||
attach="map"
|
attach="map"
|
||||||
args={[video]}
|
args={[video]}
|
||||||
@@ -75,20 +78,18 @@ const App = () => {
|
|||||||
/>
|
/>
|
||||||
</meshStandardMaterial>
|
</meshStandardMaterial>
|
||||||
</Text>
|
</Text>
|
||||||
<mesh position={[2, 1.8, -3.2]}>
|
<mesh position={[2, 1.8, -3.2]} ref={cloudRef} onPointerEnter={meshAnimation} fog={false}>
|
||||||
<sphereBufferGeometry attach="geometry" />
|
<sphereBufferGeometry attach="geometry" />
|
||||||
<MeshDistortMaterial
|
<MeshDistortMaterial
|
||||||
attach="material"
|
attach="material"
|
||||||
color="#EDEDED"
|
color="#EDEDED"
|
||||||
distort={1} // Strength, 0 disables the effect (default=1)
|
distort={0.5} // Strength, 0 disables the effect (default=1)
|
||||||
speed={2} // Speed (default=1)
|
speed={1} // Speed (default=1)
|
||||||
/>
|
/>
|
||||||
</mesh>
|
</mesh>
|
||||||
|
<pointLight position={[-1, 0, 0]} />
|
||||||
<Floor />
|
<Floor />
|
||||||
</group>
|
</group>
|
||||||
<ambientLight position={[0, 0, -1]} intensity={0.5} />
|
|
||||||
<spotLight position={[0, 0, 0]} intensity={0.3} />
|
|
||||||
<directionalLight position={[0, 0, 0]} intensity={0.7} />
|
|
||||||
<Environment preset="city" />
|
<Environment preset="city" />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import App from '../components/App';
|
|||||||
render(
|
render(
|
||||||
<>
|
<>
|
||||||
<Suspense fallback={null}>
|
<Suspense fallback={null}>
|
||||||
<Canvas gl={{ alpha: false}} pixelRatio={[1, 1.5]} camera={{ position: [0, 0, 0]}} id="canvas-container" style={{position: 'absolute'}}>
|
<Canvas mode='concurrent' dpr={[1, 1.5]} camera={{ position: [0, 0, 0]}} id="canvas-container" style={{position: 'absolute'}}>
|
||||||
<App />
|
<App />
|
||||||
</Canvas>
|
</Canvas>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
|||||||
Reference in New Issue
Block a user