-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathline.js
More file actions
30 lines (30 loc) · 835 Bytes
/
Copy pathline.js
File metadata and controls
30 lines (30 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import control from "./control.js";
const line = document.createElement("canvas");
line.width = 1600;
line.height = 900;
line.id = "line";
document.body.append(line);
let ctx = line.getContext("2d");
export function drawline() {
for (let i = 0; i < 15; i++) {
let lst1 = control.convert(i, 0);
let lst2 = control.convert(i, 19);
ctx.moveTo(lst1[0], lst1[1]);
ctx.lineTo(lst2[0], lst2[1]);
ctx.strokeStyle = "white";
ctx.lineWidth = 3;
ctx.lineCap = "round";
ctx.setLineDash([10, 15]);
ctx.stroke();
}
for (let i = 0; i < 20; i++) {
let lst1 = control.convert(0, i);
let lst2 = control.convert(14, i);
ctx.moveTo(lst1[0], lst1[1]);
ctx.lineTo(lst2[0], lst2[1]);
ctx.stroke();
}
}
export function clear() {
ctx.clearRect(0, 0, 1600, 900);
}