Created a simple scene for 3DTTT

main
Minh D. Bui 2 years ago
parent ac5ace85c7
commit 622a0bc615

@ -3,12 +3,16 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@react-three/drei": "^9.57.2",
"@react-three/fiber": "^8.12.0",
"@testing-library/jest-dom": "^5.16.5", "@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0", "@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0", "@testing-library/user-event": "^13.5.0",
"@types/three": "^0.149.0",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-scripts": "5.0.1", "react-scripts": "5.0.1",
"three": "^0.150.1",
"web-vitals": "^2.1.4" "web-vitals": "^2.1.4"
}, },
"scripts": { "scripts": {

@ -1,38 +1 @@
.App { /* Add styles here */
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

@ -1,25 +1,32 @@
import logo from './logo.svg'; import React from "react";
import './App.css';
import { Canvas } from '@react-three/fiber'
import { OrbitControls, Environment } from '@react-three/drei'
import space from './space.hdr'
// Import styles
import './App.css'
function App() { function App() {
return ( return (
<div className="App"> <>
<header className="App-header"> <Canvas camera={{
<img src={logo} className="App-logo" alt="logo" /> fov: 50,
<p> position: [-10, -5, -15],
Edit <code>src/App.js</code> and save to reload. rotation: [Math.PI, 0, 0] }}>
</p>
<a <OrbitControls maxDistance={40} enableDampling />
className="App-link"
href="https://reactjs.org" <ambientLight/>
target="_blank" <pointLight
rel="noopener noreferrer" position={[-150, 300, -300]}
> intensity={0.9}
Learn React />
</a> <Environment background={true} files={space} />
</header> </Canvas>
</div> </>
); );
} };
export default App; export default React.memo(App);

@ -0,0 +1 @@
// Create the CubeMesh component

@ -0,0 +1 @@
// Create the GameInfo component

@ -0,0 +1 @@
// Create the GridBox component

@ -0,0 +1 @@
// Create the GridLine component

@ -0,0 +1 @@
// Create the SphereMesh component

@ -0,0 +1 @@
// Create the WinnerLine component

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 KiB

@ -1,3 +1,12 @@
html,
body,
#root {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
body { body {
margin: 0; margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
@ -11,3 +20,4 @@ code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace; monospace;
} }

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save