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
36
37
38
39
| import * as $ from "jquery";
$(() =>
{
let canvas = document.getElementById("renderCanvas") as HTMLCanvasElement;
let ctx = canvas.getContext("2d");
// Red circle
ctx.fillStyle = "#ff0000";
ctx.beginPath();
ctx.arc(50, 150, 20, 0, 2 * Math.PI);
ctx.fill();
// Green circle
ctx.fillStyle = "#00ff00";
ctx.beginPath();
ctx.arc(150, 150, 30, 0, 2 * Math.PI);
ctx.fill();
// Blue circle
ctx.fillStyle = "#0000ff";
ctx.beginPath();
ctx.arc(50, 40, 40, 0, 2 * Math.PI);
ctx.fill();
// Rectangle with a border
ctx.fillStyle = "yellow";
ctx.strokeStyle = "magenta";
ctx.lineWidth = 5;
ctx.beginPath();
ctx.rect(50, 40, 200, 50);
ctx.fill();
ctx.stroke();
// Text
ctx.font = "24px Arial";
ctx.fillStyle = "red";
ctx.fillText("Начать игру", 80, 70);
}); |