Skip to content

Commit cf91b56

Browse files
committed
simple
1 parent 34c8ddd commit cf91b56

File tree

13 files changed

+2382
-2417
lines changed

13 files changed

+2382
-2417
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//
55
// this is inspired from https://youtu.be/AYRxDoUxcfQ?t=1103s (see: https://github.com/github/codespaces-preact/blob/782235cc78702dc2a46a6906979356b51ac269d5/.devcontainer/devcontainer.json)
66
//
7-
"image": "mcr.microsoft.com/vscode/devcontainers/javascript-node:20",
7+
"image": "mcr.microsoft.com/vscode/devcontainers/javascript-node:22",
88
// "hostRequirements": {
99
// "cpus": 4
1010
// },
@@ -17,10 +17,8 @@
1717
"openFiles": ["src/App.tsx"]
1818
},
1919
"vscode": {
20-
"settings": {},
21-
"extensions": [
22-
"dbaeumer.vscode-eslint"
23-
]
20+
"settings": {},
21+
"extensions": ["dbaeumer.vscode-eslint"]
2422
}
2523
},
2624
"portsAttributes": {

.github/workflows/deploy.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ jobs:
2727
build:
2828
runs-on: ubuntu-latest
2929
steps:
30-
- uses: actions/checkout@v3
31-
- uses: actions/setup-node@v3
32-
with:
33-
node-version: "20"
34-
cache: "npm"
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-node@v4
3532
- run: npm ci
3633
- run: npx vite build --base="/$REPONAME/"
3734
env:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Try on: [Codespace](https://github.com/codespaces/new?template_repository=abernier%2Ftpl-react-three) | [StackBlitz](https://stackblitz.com/github/abernier/tpl-react-three) | [Codesandbox](https://codesandbox.io/s/github/abernier/tpl-react-three)
1+
Try on: [Codespace](https://github.com/codespaces/new?template_repository=abernier%2Ftpl-react-three-simple) | [StackBlitz](https://stackblitz.com/github/abernier/tpl-react-three-simple) | [Codesandbox](https://codesandbox.io/s/github/abernier/tpl-react-three-simple)
22

33
# INSTALL
44

package-lock.json

Lines changed: 2320 additions & 1711 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,23 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12-
"@emotion/react": "^11.11.4",
13-
"@emotion/styled": "^11.11.0",
14-
"@react-three/drei": "^9.102.6",
15-
"@react-three/fiber": "^8.15.19",
16-
"@react-three/rapier": "^1.3.0",
17-
"@react-three/xr": "^5.7.1",
12+
"@emotion/react": "^11.13.3",
13+
"@emotion/styled": "^11.13.0",
14+
"@react-three/drei": "^9.112.0",
15+
"@react-three/fiber": "^8.17.7",
1816
"leva": "^0.9.35",
19-
"nipplejs": "^0.10.1",
20-
"react": "^18.2.0",
21-
"react-dom": "^18.2.0",
22-
"three": "^0.162.0"
17+
"react": "^18.3.1",
18+
"react-dom": "^18.3.1",
19+
"three": "^0.168.0"
2320
},
2421
"devDependencies": {
25-
"@types/react": "^18.2.69",
26-
"@types/react-dom": "^18.2.22",
27-
"@types/three": "^0.162.0",
28-
"@vitejs/plugin-react": "^4.2.1",
29-
"eslint": "^8.57.0",
22+
"@types/react": "^18.3.7",
23+
"@types/react-dom": "^18.3.0",
24+
"@types/three": "^0.168.0",
25+
"@vitejs/plugin-react": "^4.3.1",
26+
"eslint": "^8.57.1",
3027
"eslint-config-react-app": "^7.0.1",
31-
"typescript": "^5.4.3",
32-
"vite": "^5.2.3"
28+
"typescript": "^5.6.2",
29+
"vite": "^5.4.6"
3330
}
3431
}

src/App.tsx

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
import { useEffect, useState } from "react";
1+
import { useState } from "react";
22
import styled from "@emotion/styled";
3-
import { Canvas, useThree } from "@react-three/fiber";
4-
import { useKeyboardControls } from "@react-three/drei";
5-
import { Physics } from "@react-three/rapier";
6-
import { XR, Controllers, Hands, VRButton, Interactive } from "@react-three/xr";
3+
import { Canvas } from "@react-three/fiber";
74

85
import Layout from "./Layout";
96
import Cube from "./components/Cube";
10-
import Ball from "./components/Ball";
117
import Ground from "./components/Ground";
12-
import { Rope } from "./components/Rope";
138

149
function App() {
1510
return (
1611
<Styled>
17-
<VRButton />
1812
<Canvas
1913
shadows
2014
// camera={{
@@ -23,21 +17,9 @@ function App() {
2317
// }}
2418
//
2519
>
26-
<XR>
27-
<Controllers />
28-
<Hands />
29-
30-
<Physics
31-
debug
32-
gravity={[0, -60, 0]}
33-
// timeStep={1 / 60}
34-
//
35-
>
36-
<Layout>
37-
<Scene />
38-
</Layout>
39-
</Physics>
40-
</XR>
20+
<Layout>
21+
<Scene />
22+
</Layout>
4123
</Canvas>
4224
</Styled>
4325
);
@@ -49,34 +31,9 @@ export const Styled = styled.div`
4931
export default App;
5032

5133
function Scene() {
52-
const [clr, setClr] = useState<string | undefined>(undefined);
53-
//
54-
// ESC key to exit XR
55-
//
56-
57-
const gl = useThree((state) => state.gl);
58-
// gl.xr.setFramebufferScaleFactor(2.0);
59-
60-
const escPressed = useKeyboardControls((state) => state.esc);
61-
useEffect(() => {
62-
gl.xr.getSession()?.end(); // https://stackoverflow.com/a/71566927/133327
63-
}, [escPressed, gl.xr]);
64-
6534
return (
6635
<>
67-
<Interactive
68-
onHover={(e) => {
69-
console.log("hover");
70-
setClr("brown");
71-
}}
72-
onBlur={(e) => setClr(undefined)}
73-
>
74-
<Cube position-y={1} color={clr} />
75-
</Interactive>
76-
<Ball />
77-
78-
<Rope length={5} position={[3, 1, 0]} />
79-
36+
<Cube position-y={1} />
8037
<Ground />
8138
</>
8239
);

0 commit comments

Comments
 (0)