master
Elijah Lucian 3 years ago
parent 03687402c9
commit b169f1372b
  1. 1
      webclient/.dockerignore
  2. 11
      webclient/Dockerfile
  3. 4
      webclient/docker.sh
  4. 14528
      webclient/package-lock.json
  5. 1
      webclient/src/Footer.js
  6. 2
      webclient/src/spaceport/Ship.js
  7. 6
      webclient/src/spaceport/scene.js

@ -0,0 +1 @@
node_modules

@ -0,0 +1,11 @@
FROM node:14
WORKDIR /usr/src/app
COPY . .
RUN npm i
EXPOSE 3000
CMD ["npm", "run", "start"]

@ -0,0 +1,4 @@
docker build . -t spaceport-client
docker run -v $PWD:/usr/src/app spaceport-client
# npm install
# npm run start

File diff suppressed because it is too large Load Diff

@ -8,6 +8,7 @@ export const Footer = () => {
useEffect(() => {
if (!footerRef.current) return;
if (footerRef.current.clientWidth < 650) return
scene({ ref: footerRef });
}, [footerRef]);

@ -54,8 +54,6 @@ export class Ship {
const a = Math.abs(this.life);
this.mesh.position.z += a * 2;
this.mesh.scale.z = a * 4;
// accelerate away
}
if (this.mesh.position.z > 55) {

@ -16,6 +16,7 @@ export const scene = ({ ref }) => {
const width = ref.current.clientWidth;
const height = ref.current.clientHeight;
renderer.setSize(width, height);
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)
if (t > nextShip) {
console.log('bing');
const ship = new Ship();
scene.add(ship.mesh);
ships.push(ship);
@ -67,16 +67,16 @@ export const scene = ({ ref }) => {
for (const ship of ships) {
ship.update({ deltaTime });
if (ship.kill) {
console.log('killing ship');
scene.remove(ship.mesh);
}
}
ships = ships.filter((s) => !s.kill);
window.addEventListener('resize', onWindowResize, false);
window.addEventListener('resize', onWindowResize);
function onWindowResize() {
console.log(ref.current.clientWidth, ref.current.clientHeight)
camera.updateProjectionMatrix();
renderer.setSize(ref.current.clientWidth, ref.current.clientHeight);
}

Loading…
Cancel
Save