-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathend.js
More file actions
35 lines (35 loc) · 1016 Bytes
/
Copy pathend.js
File metadata and controls
35 lines (35 loc) · 1016 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
31
32
33
34
35
import control from "./control.js";
const end = document.createElement("canvas");
end.width = 1600;
end.height = 900;
end.id = "end";
document.body.append(end);
const ctx = end.getContext("2d");
const End = {
num: 0,
position: [0, 0],
draw() {
let lst = control.convert(this.position[0], this.position[1]);
let gra = ctx.createLinearGradient(lst[0], lst[1], lst[0], lst[1] + 92);
gra.addColorStop(0, "#222");
gra.addColorStop(1, "#aaa");
ctx.fillStyle = gra;
ctx.beginPath();
ctx.moveTo(lst[0] + 24, lst[1] + 32);
ctx.lineTo(lst[0], lst[1]);
ctx.lineTo(lst[0] + 80, lst[1]);
ctx.lineTo(lst[0] + 80, lst[1] + 32);
ctx.fill();
ctx.beginPath();
ctx.moveTo(lst[0] + 80, lst[1] + 32);
ctx.lineTo(lst[0] + 80, lst[1]);
ctx.lineTo(lst[0] + 104, lst[1] + 32);
gra.addColorStop(0, "#000");
gra.addColorStop(1, "#888");
ctx.fill();
},
clear() {
ctx.clearRect(0, 0, 1600, 900);
},
};
export default End;