react-three-fiber added
This commit is contained in:
		
							parent
							
								
									8de30cba1e
								
							
						
					
					
						commit
						cb7da52af8
					
				
							
								
								
									
										274
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										274
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -8,8 +8,11 @@ | ||||
|       "name": "vite-project", | ||||
|       "version": "0.0.0", | ||||
|       "dependencies": { | ||||
|         "@react-three/fiber": "^8.17.8", | ||||
|         "@types/three": "^0.169.0", | ||||
|         "react": "^18.3.1", | ||||
|         "react-dom": "^18.3.1" | ||||
|         "react-dom": "^18.3.1", | ||||
|         "three": "^0.169.0" | ||||
|       }, | ||||
|       "devDependencies": { | ||||
|         "@eslint/js": "^9.9.0", | ||||
| @ -26,6 +29,17 @@ | ||||
|         "vite": "^5.4.1" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@babel/runtime": { | ||||
|       "version": "7.25.6", | ||||
|       "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.6.tgz", | ||||
|       "integrity": "sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==", | ||||
|       "dependencies": { | ||||
|         "regenerator-runtime": "^0.14.0" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=6.9.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@esbuild/win32-x64": { | ||||
|       "version": "0.21.5", | ||||
|       "cpu": [ | ||||
| @ -211,6 +225,63 @@ | ||||
|         "node": ">= 8" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@react-three/fiber": { | ||||
|       "version": "8.17.8", | ||||
|       "resolved": "https://registry.npmjs.org/@react-three/fiber/-/fiber-8.17.8.tgz", | ||||
|       "integrity": "sha512-L2r8n4Ebg7YMTMaPHx1soxplgfia7SpAJUA1bS4C1ApRG9KKAjK8Kjhx3ODX3f6fyYfQZju2JyE8Q7OJHv1DNA==", | ||||
|       "dependencies": { | ||||
|         "@babel/runtime": "^7.17.8", | ||||
|         "@types/debounce": "^1.2.1", | ||||
|         "@types/react-reconciler": "^0.26.7", | ||||
|         "@types/webxr": "*", | ||||
|         "base64-js": "^1.5.1", | ||||
|         "buffer": "^6.0.3", | ||||
|         "debounce": "^1.2.1", | ||||
|         "its-fine": "^1.0.6", | ||||
|         "react-reconciler": "^0.27.0", | ||||
|         "scheduler": "^0.21.0", | ||||
|         "suspend-react": "^0.1.3", | ||||
|         "zustand": "^3.7.1" | ||||
|       }, | ||||
|       "peerDependencies": { | ||||
|         "expo": ">=43.0", | ||||
|         "expo-asset": ">=8.4", | ||||
|         "expo-file-system": ">=11.0", | ||||
|         "expo-gl": ">=11.0", | ||||
|         "react": ">=18.0", | ||||
|         "react-dom": ">=18.0", | ||||
|         "react-native": ">=0.64", | ||||
|         "three": ">=0.133" | ||||
|       }, | ||||
|       "peerDependenciesMeta": { | ||||
|         "expo": { | ||||
|           "optional": true | ||||
|         }, | ||||
|         "expo-asset": { | ||||
|           "optional": true | ||||
|         }, | ||||
|         "expo-file-system": { | ||||
|           "optional": true | ||||
|         }, | ||||
|         "expo-gl": { | ||||
|           "optional": true | ||||
|         }, | ||||
|         "react-dom": { | ||||
|           "optional": true | ||||
|         }, | ||||
|         "react-native": { | ||||
|           "optional": true | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@react-three/fiber/node_modules/scheduler": { | ||||
|       "version": "0.21.0", | ||||
|       "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.21.0.tgz", | ||||
|       "integrity": "sha512-1r87x5fz9MXqswA2ERLo0EbOAU74DpIUO090gIasYTqlVoJeMcl+Z1Rg7WHz+qtPujhS/hGIt9kxZOYBV3faRQ==", | ||||
|       "dependencies": { | ||||
|         "loose-envify": "^1.1.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@rollup/rollup-win32-x64-msvc": { | ||||
|       "version": "4.22.5", | ||||
|       "cpu": [ | ||||
| @ -288,6 +359,16 @@ | ||||
|         "@swc/counter": "^0.1.3" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@tweenjs/tween.js": { | ||||
|       "version": "23.1.3", | ||||
|       "resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-23.1.3.tgz", | ||||
|       "integrity": "sha512-vJmvvwFxYuGnF2axRtPYocag6Clbb5YS7kLL+SO/TeVFzHqDIWrNKYtcsPMibjDx9O+bu+psAy9NKfWklassUA==" | ||||
|     }, | ||||
|     "node_modules/@types/debounce": { | ||||
|       "version": "1.2.4", | ||||
|       "resolved": "https://registry.npmjs.org/@types/debounce/-/debounce-1.2.4.tgz", | ||||
|       "integrity": "sha512-jBqiORIzKDOToaF63Fm//haOCHuwQuLa2202RK4MozpA6lh93eCBc+/8+wZn5OzjJt3ySdc+74SXWXB55Ewtyw==" | ||||
|     }, | ||||
|     "node_modules/@types/estree": { | ||||
|       "version": "1.0.6", | ||||
|       "dev": true, | ||||
| @ -300,12 +381,10 @@ | ||||
|     }, | ||||
|     "node_modules/@types/prop-types": { | ||||
|       "version": "15.7.13", | ||||
|       "dev": true, | ||||
|       "license": "MIT" | ||||
|     }, | ||||
|     "node_modules/@types/react": { | ||||
|       "version": "18.3.10", | ||||
|       "dev": true, | ||||
|       "license": "MIT", | ||||
|       "dependencies": { | ||||
|         "@types/prop-types": "*", | ||||
| @ -320,6 +399,37 @@ | ||||
|         "@types/react": "*" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@types/react-reconciler": { | ||||
|       "version": "0.26.7", | ||||
|       "resolved": "https://registry.npmjs.org/@types/react-reconciler/-/react-reconciler-0.26.7.tgz", | ||||
|       "integrity": "sha512-mBDYl8x+oyPX/VBb3E638N0B7xG+SPk/EAMcVPeexqus/5aTpTphQi0curhhshOqRrc9t6OPoJfEUkbymse/lQ==", | ||||
|       "dependencies": { | ||||
|         "@types/react": "*" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@types/stats.js": { | ||||
|       "version": "0.17.3", | ||||
|       "resolved": "https://registry.npmjs.org/@types/stats.js/-/stats.js-0.17.3.tgz", | ||||
|       "integrity": "sha512-pXNfAD3KHOdif9EQXZ9deK82HVNaXP5ZIF5RP2QG6OQFNTaY2YIetfrE9t528vEreGQvEPRDDc8muaoYeK0SxQ==" | ||||
|     }, | ||||
|     "node_modules/@types/three": { | ||||
|       "version": "0.169.0", | ||||
|       "resolved": "https://registry.npmjs.org/@types/three/-/three-0.169.0.tgz", | ||||
|       "integrity": "sha512-oan7qCgJBt03wIaK+4xPWclYRPG9wzcg7Z2f5T8xYTNEF95kh0t0lklxLLYBDo7gQiGLYzE6iF4ta7nXF2bcsw==", | ||||
|       "dependencies": { | ||||
|         "@tweenjs/tween.js": "~23.1.3", | ||||
|         "@types/stats.js": "*", | ||||
|         "@types/webxr": "*", | ||||
|         "@webgpu/types": "*", | ||||
|         "fflate": "~0.8.2", | ||||
|         "meshoptimizer": "~0.18.1" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@types/webxr": { | ||||
|       "version": "0.5.20", | ||||
|       "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.20.tgz", | ||||
|       "integrity": "sha512-JGpU6qiIJQKUuVSKx1GtQnHJGxRjtfGIhzO2ilq43VZZS//f1h1Sgexbdk+Lq+7569a6EYhOWrUpIruR/1Enmg==" | ||||
|     }, | ||||
|     "node_modules/@typescript-eslint/eslint-plugin": { | ||||
|       "version": "8.7.0", | ||||
|       "dev": true, | ||||
| @ -538,6 +648,11 @@ | ||||
|         "vite": "^4 || ^5" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@webgpu/types": { | ||||
|       "version": "0.1.46", | ||||
|       "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.46.tgz", | ||||
|       "integrity": "sha512-2iogO6Zh0pTbKLGZuuGWEmJpF/fTABGs7G9wXxpn7s24XSJchSUIiMqIJHURi5zsMZRRTuXrV/3GLOkmOFjq5w==" | ||||
|     }, | ||||
|     "node_modules/acorn": { | ||||
|       "version": "8.12.1", | ||||
|       "dev": true, | ||||
| @ -741,6 +856,25 @@ | ||||
|       "dev": true, | ||||
|       "license": "MIT" | ||||
|     }, | ||||
|     "node_modules/base64-js": { | ||||
|       "version": "1.5.1", | ||||
|       "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", | ||||
|       "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", | ||||
|       "funding": [ | ||||
|         { | ||||
|           "type": "github", | ||||
|           "url": "https://github.com/sponsors/feross" | ||||
|         }, | ||||
|         { | ||||
|           "type": "patreon", | ||||
|           "url": "https://www.patreon.com/feross" | ||||
|         }, | ||||
|         { | ||||
|           "type": "consulting", | ||||
|           "url": "https://feross.org/support" | ||||
|         } | ||||
|       ] | ||||
|     }, | ||||
|     "node_modules/brace-expansion": { | ||||
|       "version": "1.1.11", | ||||
|       "dev": true, | ||||
| @ -761,6 +895,29 @@ | ||||
|         "node": ">=8" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/buffer": { | ||||
|       "version": "6.0.3", | ||||
|       "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", | ||||
|       "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", | ||||
|       "funding": [ | ||||
|         { | ||||
|           "type": "github", | ||||
|           "url": "https://github.com/sponsors/feross" | ||||
|         }, | ||||
|         { | ||||
|           "type": "patreon", | ||||
|           "url": "https://www.patreon.com/feross" | ||||
|         }, | ||||
|         { | ||||
|           "type": "consulting", | ||||
|           "url": "https://feross.org/support" | ||||
|         } | ||||
|       ], | ||||
|       "dependencies": { | ||||
|         "base64-js": "^1.3.1", | ||||
|         "ieee754": "^1.2.1" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/call-bind": { | ||||
|       "version": "1.0.7", | ||||
|       "dev": true, | ||||
| @ -838,7 +995,6 @@ | ||||
|     }, | ||||
|     "node_modules/csstype": { | ||||
|       "version": "3.1.3", | ||||
|       "dev": true, | ||||
|       "license": "MIT" | ||||
|     }, | ||||
|     "node_modules/data-view-buffer": { | ||||
| @ -889,6 +1045,11 @@ | ||||
|         "url": "https://github.com/sponsors/ljharb" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/debounce": { | ||||
|       "version": "1.2.1", | ||||
|       "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", | ||||
|       "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==" | ||||
|     }, | ||||
|     "node_modules/debug": { | ||||
|       "version": "4.3.7", | ||||
|       "dev": true, | ||||
| @ -1399,6 +1560,11 @@ | ||||
|         "reusify": "^1.0.4" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/fflate": { | ||||
|       "version": "0.8.2", | ||||
|       "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", | ||||
|       "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==" | ||||
|     }, | ||||
|     "node_modules/file-entry-cache": { | ||||
|       "version": "8.0.0", | ||||
|       "dev": true, | ||||
| @ -1655,6 +1821,25 @@ | ||||
|         "node": ">= 0.4" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/ieee754": { | ||||
|       "version": "1.2.1", | ||||
|       "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", | ||||
|       "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", | ||||
|       "funding": [ | ||||
|         { | ||||
|           "type": "github", | ||||
|           "url": "https://github.com/sponsors/feross" | ||||
|         }, | ||||
|         { | ||||
|           "type": "patreon", | ||||
|           "url": "https://www.patreon.com/feross" | ||||
|         }, | ||||
|         { | ||||
|           "type": "consulting", | ||||
|           "url": "https://feross.org/support" | ||||
|         } | ||||
|       ] | ||||
|     }, | ||||
|     "node_modules/ignore": { | ||||
|       "version": "5.3.2", | ||||
|       "dev": true, | ||||
| @ -2044,6 +2229,25 @@ | ||||
|         "set-function-name": "^2.0.1" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/its-fine": { | ||||
|       "version": "1.2.5", | ||||
|       "resolved": "https://registry.npmjs.org/its-fine/-/its-fine-1.2.5.tgz", | ||||
|       "integrity": "sha512-fXtDA0X0t0eBYAGLVM5YsgJGsJ5jEmqZEPrGbzdf5awjv0xE7nqv3TVnvtUF060Tkes15DbDAKW/I48vsb6SyA==", | ||||
|       "dependencies": { | ||||
|         "@types/react-reconciler": "^0.28.0" | ||||
|       }, | ||||
|       "peerDependencies": { | ||||
|         "react": ">=18.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/its-fine/node_modules/@types/react-reconciler": { | ||||
|       "version": "0.28.8", | ||||
|       "resolved": "https://registry.npmjs.org/@types/react-reconciler/-/react-reconciler-0.28.8.tgz", | ||||
|       "integrity": "sha512-SN9c4kxXZonFhbX4hJrZy37yw9e7EIxcpHCxQv5JUS18wDE5ovkQKlqQEkufdJCCMfuI9BnjUJvhYeJ9x5Ra7g==", | ||||
|       "dependencies": { | ||||
|         "@types/react": "*" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/js-tokens": { | ||||
|       "version": "4.0.0", | ||||
|       "license": "MIT" | ||||
| @ -2145,6 +2349,11 @@ | ||||
|         "node": ">= 8" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/meshoptimizer": { | ||||
|       "version": "0.18.1", | ||||
|       "resolved": "https://registry.npmjs.org/meshoptimizer/-/meshoptimizer-0.18.1.tgz", | ||||
|       "integrity": "sha512-ZhoIoL7TNV4s5B6+rx5mC//fw8/POGyNxS/DZyCJeiZ12ScLfVwRE/GfsxwiTkMYYD5DmK2/JXnEVXqL4rF+Sw==" | ||||
|     }, | ||||
|     "node_modules/micromatch": { | ||||
|       "version": "4.0.8", | ||||
|       "dev": true, | ||||
| @ -2483,6 +2692,29 @@ | ||||
|       "dev": true, | ||||
|       "license": "MIT" | ||||
|     }, | ||||
|     "node_modules/react-reconciler": { | ||||
|       "version": "0.27.0", | ||||
|       "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.27.0.tgz", | ||||
|       "integrity": "sha512-HmMDKciQjYmBRGuuhIaKA1ba/7a+UsM5FzOZsMO2JYHt9Jh8reCb7j1eDC95NOyUlKM9KRyvdx0flBuDvYSBoA==", | ||||
|       "dependencies": { | ||||
|         "loose-envify": "^1.1.0", | ||||
|         "scheduler": "^0.21.0" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=0.10.0" | ||||
|       }, | ||||
|       "peerDependencies": { | ||||
|         "react": "^18.0.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/react-reconciler/node_modules/scheduler": { | ||||
|       "version": "0.21.0", | ||||
|       "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.21.0.tgz", | ||||
|       "integrity": "sha512-1r87x5fz9MXqswA2ERLo0EbOAU74DpIUO090gIasYTqlVoJeMcl+Z1Rg7WHz+qtPujhS/hGIt9kxZOYBV3faRQ==", | ||||
|       "dependencies": { | ||||
|         "loose-envify": "^1.1.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/reflect.getprototypeof": { | ||||
|       "version": "1.0.6", | ||||
|       "dev": true, | ||||
| @ -2503,6 +2735,11 @@ | ||||
|         "url": "https://github.com/sponsors/ljharb" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/regenerator-runtime": { | ||||
|       "version": "0.14.1", | ||||
|       "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", | ||||
|       "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" | ||||
|     }, | ||||
|     "node_modules/regexp.prototype.flags": { | ||||
|       "version": "1.5.2", | ||||
|       "dev": true, | ||||
| @ -2858,11 +3095,24 @@ | ||||
|         "url": "https://github.com/sponsors/ljharb" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/suspend-react": { | ||||
|       "version": "0.1.3", | ||||
|       "resolved": "https://registry.npmjs.org/suspend-react/-/suspend-react-0.1.3.tgz", | ||||
|       "integrity": "sha512-aqldKgX9aZqpoDp3e8/BZ8Dm7x1pJl+qI3ZKxDN0i/IQTWUwBx/ManmlVJ3wowqbno6c2bmiIfs+Um6LbsjJyQ==", | ||||
|       "peerDependencies": { | ||||
|         "react": ">=17.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/text-table": { | ||||
|       "version": "0.2.0", | ||||
|       "dev": true, | ||||
|       "license": "MIT" | ||||
|     }, | ||||
|     "node_modules/three": { | ||||
|       "version": "0.169.0", | ||||
|       "resolved": "https://registry.npmjs.org/three/-/three-0.169.0.tgz", | ||||
|       "integrity": "sha512-Ed906MA3dR4TS5riErd4QBsRGPcx+HBDX2O5yYE5GqJeFQTPU+M56Va/f/Oph9X7uZo3W3o4l2ZhBZ6f6qUv0w==" | ||||
|     }, | ||||
|     "node_modules/to-regex-range": { | ||||
|       "version": "5.0.1", | ||||
|       "dev": true, | ||||
| @ -3186,6 +3436,22 @@ | ||||
|       "funding": { | ||||
|         "url": "https://github.com/sponsors/sindresorhus" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/zustand": { | ||||
|       "version": "3.7.2", | ||||
|       "resolved": "https://registry.npmjs.org/zustand/-/zustand-3.7.2.tgz", | ||||
|       "integrity": "sha512-PIJDIZKtokhof+9+60cpockVOq05sJzHCriyvaLBmEJixseQ1a5Kdov6fWZfWOu5SK9c+FhH1jU0tntLxRJYMA==", | ||||
|       "engines": { | ||||
|         "node": ">=12.7.0" | ||||
|       }, | ||||
|       "peerDependencies": { | ||||
|         "react": ">=16.8" | ||||
|       }, | ||||
|       "peerDependenciesMeta": { | ||||
|         "react": { | ||||
|           "optional": true | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -10,8 +10,11 @@ | ||||
|     "preview": "vite preview" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "@react-three/fiber": "^8.17.8", | ||||
|     "@types/three": "^0.169.0", | ||||
|     "react": "^18.3.1", | ||||
|     "react-dom": "^18.3.1" | ||||
|     "react-dom": "^18.3.1", | ||||
|     "three": "^0.169.0" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@eslint/js": "^9.9.0", | ||||
|  | ||||
							
								
								
									
										39
									
								
								src/App.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								src/App.tsx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,39 @@ | ||||
| import React from 'react' | ||||
| import * as Fiber from '@react-three/fiber' | ||||
| import Three from 'three' | ||||
| 
 | ||||
| const ThreeBox:React.FC<{position?:Fiber.Vector3}> =(args)=> { | ||||
|   const meshRef = React.useRef<Three.Mesh>(null) | ||||
|   const [hovered, setHover] = React.useState(false) | ||||
|   const [active, setActive] = React.useState(false) | ||||
|   Fiber.useFrame((_state, delta) => meshRef.current&&(meshRef.current.rotation.x += delta)) | ||||
|   return <mesh | ||||
|     position={args.position} | ||||
|     ref={meshRef} | ||||
|     scale={active ? 1.5 : 1} | ||||
|     onClick={_=> setActive(!active)} | ||||
|     onPointerOver={_=> setHover(true)} | ||||
|     onPointerOut ={_=> setHover(false)}> | ||||
|     <boxGeometry args={[1, 1, 1]} /> | ||||
|     <meshStandardMaterial color={hovered ? 'hotpink' : 'orange'} /> | ||||
|   </mesh> | ||||
| } | ||||
| 
 | ||||
| const ThreeStage:React.FC =()=> <Fiber.Canvas> | ||||
|   <ambientLight intensity={Math.PI / 2} /> | ||||
|   <spotLight position={[10, 10, 10]} angle={0.15} penumbra={1} decay={0} intensity={Math.PI} /> | ||||
|   <pointLight position={[-10, -10, -10]} decay={0} intensity={Math.PI} /> | ||||
|   <ThreeBox position={[-1.2, 0, 0]} /> | ||||
|   <ThreeBox position={[1.2, 0, 0]} /> | ||||
| </Fiber.Canvas>; | ||||
| 
 | ||||
| 
 | ||||
| export default function App() { | ||||
|   const [count, setCount] = React.useState(0) | ||||
|   return <> | ||||
|     <button onClick={() => setCount((count) => count + 1)}> | ||||
|       le count {count} | ||||
|     </button> | ||||
|     <ThreeStage/> | ||||
|   </>; | ||||
| } | ||||
| @ -1,12 +1,6 @@ | ||||
| import React from 'react' | ||||
| import ReactDOM from 'react-dom/client' | ||||
| 
 | ||||
| function App() { | ||||
|   const [count, setCount] = React.useState(0) | ||||
|   return <button onClick={() => setCount((count) => count + 1)}> | ||||
|     count is {count} | ||||
|   </button>; | ||||
| } | ||||
| import App from "./App"; | ||||
| 
 | ||||
| const root = document.getElementById('root'); | ||||
| root && ReactDOM.createRoot(root).render(<React.StrictMode><App /></React.StrictMode>); | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user