-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
055e8dc
commit 7a47531
Showing
21 changed files
with
323 additions
and
598 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
# Harsh Bhardwaj 3D-Portfolio | ||
<!-- @format --> | ||
|
||
# Harsh Bhardwaj 3D-Portfolio | ||
<h2>Don't fork this portfolio will not work because of some hidden content</h2> | ||
<h2>For better view use laptop, desktop, Tablet, instead of phone</h2> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
/** @format */ | ||
|
||
import { Html, useProgress } from "@react-three/drei"; | ||
|
||
const CanvasLoader = () => { | ||
const { progress } = useProgress(); | ||
return ( | ||
<Html | ||
as='div' | ||
center | ||
style={{ | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
flexDirection: "column", | ||
}} | ||
> | ||
<span className='canvas-loader'></span> | ||
<p | ||
style={{ | ||
fontSize: 14, | ||
color: "#F1F1F1", | ||
fontWeight: 800, | ||
marginTop: 40, | ||
}} | ||
> | ||
{progress.toFixed(2)}% | ||
</p> | ||
</Html> | ||
); | ||
const { progress } = useProgress(); | ||
return ( | ||
<Html | ||
as="div" | ||
center | ||
style={{ | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
flexDirection: "column", | ||
}}> | ||
<span className="canvas-loader"></span> | ||
<p | ||
style={{ | ||
fontSize: 14, | ||
color: "#F1F1F1", | ||
fontWeight: 800, | ||
marginTop: 40, | ||
}}> | ||
{progress.toFixed(2)}% | ||
</p> | ||
</Html> | ||
); | ||
}; | ||
|
||
export default CanvasLoader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,82 @@ | ||
/** @format */ | ||
|
||
import React, { Suspense, useEffect, useState } from "react"; | ||
import { Canvas } from "@react-three/fiber"; | ||
import { OrbitControls, Preload, useGLTF } from "@react-three/drei"; | ||
|
||
import CanvasLoader from "../Loader"; | ||
|
||
const Computers = ({ isMobile }) => { | ||
const computer = useGLTF("./desktop_pc/scene.gltf"); | ||
const computer = useGLTF("./desktop_pc/scene.gltf"); | ||
|
||
return ( | ||
<mesh> | ||
<hemisphereLight intensity={0.15} groundColor='black' /> | ||
<spotLight | ||
position={[-20, 50, 10]} | ||
angle={0.12} | ||
penumbra={1} | ||
intensity={1} | ||
castShadow | ||
shadow-mapSize={1024} | ||
/> | ||
<pointLight intensity={1} /> | ||
<primitive | ||
object={computer.scene} | ||
scale={isMobile ? 0.7 : 0.75} | ||
position={isMobile ? [0, -3, -2.2] : [0, -3.25, -1.5]} | ||
rotation={[-0.01, -0.2, -0.1]} | ||
/> | ||
</mesh> | ||
); | ||
return ( | ||
<mesh> | ||
<hemisphereLight | ||
intensity={0.15} | ||
groundColor="black" | ||
/> | ||
<spotLight | ||
position={[-20, 50, 10]} | ||
angle={0.12} | ||
penumbra={1} | ||
intensity={1} | ||
castShadow | ||
shadow-mapSize={1024} | ||
/> | ||
<pointLight intensity={1} /> | ||
<primitive | ||
object={computer.scene} | ||
scale={isMobile ? 0.7 : 0.75} | ||
position={isMobile ? [0, -3, -2.2] : [0, -3.25, -1.5]} | ||
rotation={[-0.01, -0.2, -0.1]} | ||
/> | ||
</mesh> | ||
); | ||
}; | ||
|
||
const ComputersCanvas = () => { | ||
const [isMobile, setIsMobile] = useState(false); | ||
const [isMobile, setIsMobile] = useState(false); | ||
|
||
useEffect(() => { | ||
// Add a listener for changes to the screen size | ||
const mediaQuery = window.matchMedia("(max-width: 500px)"); | ||
useEffect(() => { | ||
// Add a listener for changes to the screen size | ||
const mediaQuery = window.matchMedia("(max-width: 500px)"); | ||
|
||
// Set the initial value of the `isMobile` state variable | ||
setIsMobile(mediaQuery.matches); | ||
// Set the initial value of the `isMobile` state variable | ||
setIsMobile(mediaQuery.matches); | ||
|
||
// Define a callback function to handle changes to the media query | ||
const handleMediaQueryChange = (event) => { | ||
setIsMobile(event.matches); | ||
}; | ||
// Define a callback function to handle changes to the media query | ||
const handleMediaQueryChange = (event) => { | ||
setIsMobile(event.matches); | ||
}; | ||
|
||
// Add the callback function as a listener for changes to the media query | ||
mediaQuery.addEventListener("change", handleMediaQueryChange); | ||
// Add the callback function as a listener for changes to the media query | ||
mediaQuery.addEventListener("change", handleMediaQueryChange); | ||
|
||
// Remove the listener when the component is unmounted | ||
return () => { | ||
mediaQuery.removeEventListener("change", handleMediaQueryChange); | ||
}; | ||
}, []); | ||
// Remove the listener when the component is unmounted | ||
return () => { | ||
mediaQuery.removeEventListener("change", handleMediaQueryChange); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<Canvas | ||
frameloop='demand' | ||
shadows | ||
dpr={[1, 2]} | ||
camera={{ position: [20, 3, 5], fov: 25 }} | ||
gl={{ preserveDrawingBuffer: true }} | ||
> | ||
<Suspense fallback={<CanvasLoader />}> | ||
<OrbitControls | ||
enableZoom={false} | ||
maxPolarAngle={Math.PI / 2} | ||
minPolarAngle={Math.PI / 2} | ||
/> | ||
<Computers isMobile={isMobile} /> | ||
</Suspense> | ||
return ( | ||
<Canvas | ||
frameloop="demand" | ||
shadows | ||
dpr={[1, 2]} | ||
camera={{ position: [20, 3, 5], fov: 25 }} | ||
gl={{ preserveDrawingBuffer: true }}> | ||
<Suspense fallback={<CanvasLoader />}> | ||
<OrbitControls | ||
enableZoom={false} | ||
maxPolarAngle={Math.PI / 2} | ||
minPolarAngle={Math.PI / 2} | ||
/> | ||
<Computers isMobile={isMobile} /> | ||
</Suspense> | ||
|
||
<Preload all /> | ||
</Canvas> | ||
); | ||
<Preload all /> | ||
</Canvas> | ||
); | ||
}; | ||
|
||
export default ComputersCanvas; |
Oops, something went wrong.