blob: 40c3f837b3a6df7833c49b50a6280a2091c9449b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import Canvas from './Canvas.js';
const $ = id => document.getElementById(id)
window.onload = () => {
const canvas = new Canvas('root');
const pos = canvas.mousePos;
canvas.onmousemove = () => canvas.draw();
canvas.ondraw = ct => {
ct.fillRect(0, 0, 0.5, 0.5);
ct.strokeStyle = '#fff';
ct.lineWidth = 0.001;
ct.beginPath();
ct.arc(pos.x, pos.y, 0.1, 0, 2*Math.PI);
ct.closePath();
ct.stroke();
};
canvas.draw();
}
|