summaryrefslogtreecommitdiff
path: root/src/main.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-03-31 18:20:15 -0500
committersanine <sanine.not@pm.me>2023-03-31 18:20:15 -0500
commit18ed948462bd71e4cb3b1e8fa3f55df84ef0ff33 (patch)
treeac82d1d496048f68373dd16f2388dba10618abac /src/main.js
parent0587c63c26e94d26700a11bc2a9459f82f043a9c (diff)
implement nice MapView object
Diffstat (limited to 'src/main.js')
-rw-r--r--src/main.js15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/main.js b/src/main.js
index f1d3635..db8963d 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,6 +1,6 @@
import Canvas from './Canvas.js';
import { Mat3, Vec3, Point, Shape } from './Geometry.js';
-import { MapGrid } from './MapView.js';
+import { MapGrid, MapView } from './MapView.js';
const $ = id => document.getElementById(id)
@@ -12,12 +12,9 @@ window.onload = () => {
const zaxis = new Vec3(0, 0, 1);
const grid = new MapGrid(30, 30);
- console.log(grid)
+ const map = new MapView(canvas);
- let view = new Mat3().rotation(xaxis, -0.3*Math.PI);
- let angle = 0;
-
- canvas.onDraw = ct => {
+ map.onDraw = (ct, view) => {
ct.fillStyle = "#01162B"
ct.fillRect(-10,-10, 100, 100);
ct.lineWidth = 0.005;
@@ -27,10 +24,4 @@ window.onload = () => {
grid.render(ct, view);
};
canvas.draw();
-
- setInterval(() => {
- angle = angle + 0.01*Math.PI;
- view.rotation(xaxis, angle);
- canvas.draw();
- }, 50);
}