-
Notifications
You must be signed in to change notification settings - Fork 0
/
hts.htm
92 lines (76 loc) · 2.44 KB
/
hts.htm
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>please</title>
<style>
body{
background-color: rgb(20, 14, 61);
}
canvas{
background-color: rgb(29, 214, 38);
display: block;
}
</style>
<script>
let graphics;
let canvas;
function draw(){
graphics.font="bold 80px serif";
graphics.fillStyle="rgb(200,200,255)";
graphics.strokeStyle="rgb(0,0,150)";
graphics.linWidth=3;
graphics.fillText("Hello world",20,80);
graphics.strokeText("Hello World",20,80);
graphics.strokeStyle ="red";
graphics.lineWidth = 5;
graphics.beginPath();
graphics.moveTo(25,120);
graphics.lineTo(575,120);
graphics.stroke();
graphics.beginPath();
graphics.moveTo(250,300); // Move to start point of arc.
graphics.arc(150,300,100,0,2*Math.PI); // A complete circle.
graphics.closePath();
graphics.fillStyle = "#FFFFAA"; // A CSS hexadecimal color code, light yellow.
graphics.strokeStyle = "black";
graphics.lineWidth = 5;
graphics.fill();
graphics.stroke();
graphics.beginPath();
graphics.moveTo(300,250);
for(let i=1;i<=9;i++){
let angle=(2*Math.PI)/8*i;
let x=350+100*Math.cos(angle);
let y=250+100*Math.sin(angle);
graphics.lineTo(x,y);
}
graphics.closePath();
let gradient = graphics.createLinearGradient(420,420,550,200);
gradient.addColorStop(0,"red");
gradient.addColorStop(0.5,"yellow");
gradient.addColorStop(1,"green");
graphics.fillStyle = gradient; // Use a linear gradient fill!
graphics.strokeStyle = "rgb(100,60,0)";
graphics.fill();
graphics.stroke();
}
function init(){
try {
canvas = document.getElementById("myTour");
graphics = canvas.getContext("2d");
} catch(e) {
document.getElementById("canvasholder").innerHTML =
"<p>Canvas graphics is not supported.<br>" +
"An error occurred while initializing graphics.</p>";
return;
}
draw();
}
window.onload=init;
</script>
</head>
<body>
<Canvas id="myTour" width="500" height="600"></Canvas>
</body>
</html>