From 50497584e1e21a7b90fd5d8f19f505eab9b1a810 Mon Sep 17 00:00:00 2001 From: Nezar Abdennur Date: Tue, 14 May 2024 23:18:36 -0400 Subject: [PATCH] Restore index.ts for gh-pages --- js/index.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 js/index.ts diff --git a/js/index.ts b/js/index.ts new file mode 100644 index 0000000..23f8ef1 --- /dev/null +++ b/js/index.ts @@ -0,0 +1,33 @@ +import { Renderer } from "./Renderer"; +import * as utils from "./utils"; +import fs from "./shaders/teaser_fragment.glsl"; +import vs from "./shaders/teaser_vertex.glsl"; + +async function main() { + let canvas = document.querySelector("canvas")!; + let { gl, program } = utils.initGL(canvas, fs, vs); + let renderer = new Renderer(gl, program, "mnist"); + + renderer.overlay.fullScreenButton.style("top", "18px"); + renderer.overlay.epochSlider.style("top", "calc(100% - 28px)"); + renderer.overlay.playButton.style("top", "calc(100% - 34px)"); + renderer.overlay.grandtourButton.style("top", "calc(100% - 34px)"); + + { + let clearBanner = utils.createLoadingBanner(renderer.overlay.figure); + let res = await fetch(new URL("../data/eigs.arrow", import.meta.url)) + await renderer.initData( + await res.arrayBuffer(), + ["E1", "E2", "E3", "E4", "E5", "E6"], + "name", + {"A1": "#e23838", "A2": "#ffb900", "B0": "#5ebd3e", "B1": "#009cdf", "B4": "#973999"}, + ); + clearBanner(); + } + + window.addEventListener("resize", () => { + renderer.setFullScreen(renderer.isFullScreen); + }); +} + +main();