From 34d0c591a9911ec64601b5e83dc65be9394b03c5 Mon Sep 17 00:00:00 2001 From: TreetopFlyer Date: Fri, 18 Nov 2022 17:09:33 -0500 Subject: [PATCH] misc --- app.js | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/app.js b/app.js index 97c4278..4418947 100644 --- a/app.js +++ b/app.js @@ -6,21 +6,21 @@ import * as RTF from 'https://esm.sh/@react-three/fiber' import { useGLTF, useAnimations, PerspectiveCamera } from 'https://esm.sh/@react-three/drei' import {html} from 'https://esm.sh/htm/react' -/**@typedef {[x:number, y:number, z:number]} V3 */ /** - * @typedef {{Type:"click", Payload:number}} ActionClick - * @typedef {{Type:"round"}} ActionRound - * @typedef {ActionClick | ActionRound} Action - */ -/** - * @typedef {{Done:boolean, Pos:V3}} StateGoal - */ -/** - * @typedef {{Round:number, Done:boolean, Goals:Array}} State - */ -/** @typedef {(inState:State, inAction:Action)=>void} Reducer */ -/** @typedef {{Initial:State, Reducer:React.Reducer, Consume:()=>GameBinding}} Game */ -/** @typedef {[State:State, Dispatcher:React.Dispatch]} GameBinding */ +@typedef {[x:number, y:number, z:number]} V3 + +@typedef {{Type:"click", Payload:number}} ActionClick +@typedef {{Type:"round"}} ActionRound +@typedef {ActionClick | ActionRound} Action + +@typedef {{Done:boolean, Pos:V3}} StateGoal + +@typedef {{Round:number, Done:boolean, Goals:Array}} State + +@typedef {(inState:State, inAction:Action)=>void} Reducer +@typedef {{Initial:State, Reducer:React.Reducer, Consume:()=>GameBinding}} Game +@typedef {[State:State, Dispatcher:React.Dispatch]} GameBinding +*/ /** @type Game */ const Game = @@ -28,8 +28,8 @@ const Game = Initial: { Round:0, - Goals:[{Done:false, Pos:[0, 0, 0]}, {Done:true, Pos:[2, 0, 0]}], - Done:false + Goals:[], + Done:true }, Reducer(inState, inAction) { @@ -38,7 +38,7 @@ const Game = { for(let i=0; ivoid})=>JSX.Element}*/ +/** @type {(props:{goal:StateGoal, handler:()=>void})=>JSX.Element} */ function Model(props) { const { nodes, animations } = useGLTF("/bounce.gltf"); @@ -102,13 +104,14 @@ function Model(props) castShadow receiveShadow geometry=${nodes.Cube.geometry} - material=${nodes.Cube.material} onClick=${e=> { e.stopPropagation(); props.handler(); } - } /> + }> + + ` }