🚀
This commit is contained in:
parent
03687402c9
commit
b169f1372b
1
webclient/.dockerignore
Normal file
1
webclient/.dockerignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
node_modules
|
11
webclient/Dockerfile
Normal file
11
webclient/Dockerfile
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
FROM node:14
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN npm i
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["npm", "run", "start"]
|
4
webclient/docker.sh
Executable file
4
webclient/docker.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
docker build . -t spaceport-client
|
||||||
|
docker run -v $PWD:/usr/src/app spaceport-client
|
||||||
|
# npm install
|
||||||
|
# npm run start
|
14528
webclient/package-lock.json
generated
Normal file
14528
webclient/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -8,6 +8,7 @@ export const Footer = () => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!footerRef.current) return;
|
if (!footerRef.current) return;
|
||||||
|
if (footerRef.current.clientWidth < 650) return
|
||||||
scene({ ref: footerRef });
|
scene({ ref: footerRef });
|
||||||
}, [footerRef]);
|
}, [footerRef]);
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,6 @@ export class Ship {
|
||||||
const a = Math.abs(this.life);
|
const a = Math.abs(this.life);
|
||||||
this.mesh.position.z += a * 2;
|
this.mesh.position.z += a * 2;
|
||||||
this.mesh.scale.z = a * 4;
|
this.mesh.scale.z = a * 4;
|
||||||
|
|
||||||
// accelerate away
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mesh.position.z > 55) {
|
if (this.mesh.position.z > 55) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ export const scene = ({ ref }) => {
|
||||||
|
|
||||||
const width = ref.current.clientWidth;
|
const width = ref.current.clientWidth;
|
||||||
const height = ref.current.clientHeight;
|
const height = ref.current.clientHeight;
|
||||||
|
|
||||||
renderer.setSize(width, height);
|
renderer.setSize(width, height);
|
||||||
|
|
||||||
const camera = new THREE.PerspectiveCamera(65, width / height, 0.01, 1000);
|
const camera = new THREE.PerspectiveCamera(65, width / height, 0.01, 1000);
|
||||||
|
@ -57,7 +58,6 @@ export const scene = ({ ref }) => {
|
||||||
// camera.z = cos(mu * Math.PI * 2)
|
// camera.z = cos(mu * Math.PI * 2)
|
||||||
|
|
||||||
if (t > nextShip) {
|
if (t > nextShip) {
|
||||||
console.log('bing');
|
|
||||||
const ship = new Ship();
|
const ship = new Ship();
|
||||||
scene.add(ship.mesh);
|
scene.add(ship.mesh);
|
||||||
ships.push(ship);
|
ships.push(ship);
|
||||||
|
@ -67,16 +67,16 @@ export const scene = ({ ref }) => {
|
||||||
for (const ship of ships) {
|
for (const ship of ships) {
|
||||||
ship.update({ deltaTime });
|
ship.update({ deltaTime });
|
||||||
if (ship.kill) {
|
if (ship.kill) {
|
||||||
console.log('killing ship');
|
|
||||||
scene.remove(ship.mesh);
|
scene.remove(ship.mesh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ships = ships.filter((s) => !s.kill);
|
ships = ships.filter((s) => !s.kill);
|
||||||
|
|
||||||
window.addEventListener('resize', onWindowResize, false);
|
window.addEventListener('resize', onWindowResize);
|
||||||
|
|
||||||
function onWindowResize() {
|
function onWindowResize() {
|
||||||
|
console.log(ref.current.clientWidth, ref.current.clientHeight)
|
||||||
camera.updateProjectionMatrix();
|
camera.updateProjectionMatrix();
|
||||||
renderer.setSize(ref.current.clientWidth, ref.current.clientHeight);
|
renderer.setSize(ref.current.clientWidth, ref.current.clientHeight);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user