diff options
Diffstat (limited to 'src/main.js')
-rw-r--r-- | src/main.js | 15 |
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); } |