MakeItAsSet/6 - Select your Character !/Will/js/main.js
2021-06-06 00:52:07 -04:00

19 lines
515 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

let $ = (elementId) => document.getElementById(elementId);
const mainCanvas = $("mainCanvas");
let _drawContext = new DrawContext(mainCanvas, window.innerWidth, window.innerHeight);
_drawContext.clear();
let _grid = new Grid(_drawContext.size, _drawContext.numberOfCells, _drawContext.cellSize);
_grid.draw(_drawContext);
mainCanvas.addEventListener('mousemove', e => {
_drawContext.clear();
_grid.cursorPosition = {
x: e.offsetX,
y: e.offsetY
};
_grid.draw(_drawContext);
});