Dockerize
This commit is contained in:
parent
0048aa191e
commit
d9623a3274
10 changed files with 243 additions and 137 deletions
37
src/index.ts
37
src/index.ts
|
|
@ -1,26 +1,40 @@
|
|||
import { glMatrix } from 'gl-matrix';
|
||||
import '../static/favicons/apple-touch-icon.png';
|
||||
import '../static/favicons/favicon-16x16.png';
|
||||
import '../static/favicons/favicon-32x32.png';
|
||||
import '../static/favicons/favicon.ico';
|
||||
//import '../static/og-image.jpg';
|
||||
import { DeltaTimeCalculator } from './helper/delta-time-calculator';
|
||||
import './index.scss';
|
||||
import { RainScene } from './scenes/rain/rain-scene';
|
||||
import { removeUnnecessaryOutlines } from './helper/remove-unnecessary-outlines';
|
||||
import { BlobScene } from './scenes/blob-scene';
|
||||
import { Scene } from './scenes/scene';
|
||||
import { TunnelScene } from './scenes/tunnel-scene';
|
||||
import './styles/index.scss';
|
||||
|
||||
const scenes = [TunnelScene, RainScene];
|
||||
const sceneIntervalInSeconds = 8;
|
||||
const scenes = [/*TunnelScene, RainScene*/ BlobScene];
|
||||
const sceneIntervalInSeconds = 80000;
|
||||
|
||||
glMatrix.setMatrixArrayType(Array);
|
||||
removeUnnecessaryOutlines();
|
||||
|
||||
const deltaTimeCalculator = new DeltaTimeCalculator();
|
||||
const canvas = document.querySelector('canvas') as HTMLCanvasElement;
|
||||
const info = document.querySelector('#info');
|
||||
const info = document.querySelector('#info') as HTMLDivElement;
|
||||
const errorText = document.querySelector('#error-text') as HTMLParamElement;
|
||||
const errors = document.querySelector('#errors') as HTMLDivElement;
|
||||
const errorsContainer = document.querySelector('#errors-container') as HTMLDivElement;
|
||||
const button = document.querySelector('#remove-clutter');
|
||||
const toggleButton = document.querySelector('#toggle-text');
|
||||
const overlay = document.querySelector('#overlay') as HTMLDivElement;
|
||||
|
||||
button.addEventListener('click', () =>
|
||||
[info, button, overlay].forEach((e) => e.remove())
|
||||
);
|
||||
let textVisible = false;
|
||||
const handleTextToggle = () => {
|
||||
[info, overlay, errors].forEach(
|
||||
(e) => (e.style.visibility = textVisible ? 'hidden' : 'inherit')
|
||||
);
|
||||
textVisible = !textVisible;
|
||||
toggleButton.innerHTML = textVisible ? 'Hide text' : 'Show text';
|
||||
};
|
||||
toggleButton.addEventListener('click', handleTextToggle);
|
||||
handleTextToggle();
|
||||
|
||||
const handleScene = async (SceneConstructor: new () => Scene) => {
|
||||
const scene = new SceneConstructor();
|
||||
|
|
@ -44,7 +58,6 @@ const handleScene = async (SceneConstructor: new () => Scene) => {
|
|||
|
||||
requestAnimationFrame(handleFrame);
|
||||
await isOver;
|
||||
|
||||
scene.destroy();
|
||||
};
|
||||
|
||||
|
|
@ -57,7 +70,7 @@ const main = async () => {
|
|||
} catch (e) {
|
||||
console.error(e);
|
||||
errorText.innerText = e;
|
||||
errorsContainer.style.display = 'flex';
|
||||
errorsContainer.style.visibility = 'visible';
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue