Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit 6e67da3

Browse files
committed
fix: add loader to the interactive 3D experience
1 parent e99b12f commit 6e67da3

File tree

1 file changed

+45
-38
lines changed

1 file changed

+45
-38
lines changed

src/routes/Landing/Hero/HeroExperience.tsx

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,55 @@ import {
55
Html,
66
PresentationControls,
77
Float,
8+
Loader,
89
} from "@react-three/drei";
910
import { Canvas } from "@react-three/fiber";
1011
import { Suspense } from "react";
1112

12-
// "Iphone 14 Pro" (https://skfb.ly/oyCED) by mister dude is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/).
13-
export default () => {
13+
const Model = () => {
1414
const { nodes, materials } = useGLTF("/iphone_14_pro.glb");
15+
return (
16+
<group dispose={null}>
17+
<group rotation={[-Math.PI / 2, 0, Math.PI]} scale={1}>
18+
<group rotation={[Math.PI / 2, 0, 0]}>
19+
<group scale={13.67}>
20+
<mesh
21+
castShadow
22+
receiveShadow
23+
geometry={nodes.defaultMaterial.geometry}
24+
material={materials.Material}
25+
>
26+
<Html
27+
className="content"
28+
position={[0, 0, -1]}
29+
rotation-y={Math.PI}
30+
scale={2}
31+
transform
32+
occlude
33+
pointerEvents="none"
34+
>
35+
<Image
36+
w="325px"
37+
src={useColorModeValue(
38+
"/screenshots/light.jpeg",
39+
"/screenshots/dark.jpeg"
40+
)}
41+
h="710px"
42+
rounded="50px"
43+
/>
44+
</Html>
45+
</mesh>
46+
</group>
47+
</group>
48+
</group>
49+
</group>
50+
);
51+
};
1552

53+
useGLTF.preload("/iphone_14_pro.glb");
54+
55+
// "Iphone 14 Pro" (https://skfb.ly/oyCED) by mister dude is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/).
56+
export default () => {
1657
return (
1758
<>
1859
<Canvas shadows dpr={[1, 2]} camera={{ fov: 50 }}>
@@ -35,47 +76,13 @@ title: Iphone 14 Pro
3576
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
3677
{/* @ts-ignore */}
3778
<Float>
38-
<group dispose={null}>
39-
<group rotation={[-Math.PI / 2, 0, Math.PI]} scale={1}>
40-
<group rotation={[Math.PI / 2, 0, 0]}>
41-
<group scale={13.67}>
42-
<mesh
43-
castShadow
44-
receiveShadow
45-
geometry={nodes.defaultMaterial.geometry}
46-
material={materials.Material}
47-
>
48-
<Html
49-
className="content"
50-
position={[0, 0, -1]}
51-
rotation-y={Math.PI}
52-
scale={2}
53-
transform
54-
occlude
55-
pointerEvents="none"
56-
>
57-
<Image
58-
w="325px"
59-
src={useColorModeValue(
60-
"/screenshots/light.jpeg",
61-
"/screenshots/dark.jpeg"
62-
)}
63-
h="710px"
64-
rounded="50px"
65-
/>
66-
</Html>
67-
</mesh>
68-
</group>
69-
</group>
70-
</group>
71-
</group>
79+
<Model />
7280
</Float>
7381
</PresentationControls>
7482
</Stage>
7583
</Suspense>
7684
</Canvas>
85+
<Loader />
7786
</>
7887
);
7988
};
80-
81-
useGLTF.preload("/iphone_14_pro.glb");

0 commit comments

Comments
 (0)