-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp10.html
More file actions
59 lines (52 loc) · 1.99 KB
/
p10.html
File metadata and controls
59 lines (52 loc) · 1.99 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CANVAS</title>
</head>
<body>
<center>
<h1>This is CANVAS TAG</h1>
<p>The HTML canvas element provides HTML a bitmaps surface to work with. it is used to draw graphics on the web page.
The <b>HTML 5 canvas tag</b> is used to drew graphics using scripting language like javaScript.
</p>
</center>
<hr>
<canvas> This is First Canvas Tag</canvas>
<canvas id="myCanvas2" width="600px" height="300px"
style="border:2px solid orange;"></canvas>
<p><b>Note:It is always necessary to specify the id attribute and the height & width attribute to define the size of the canvas You can have multiple canvas elements on one HTML page</b></p>
<hr>
<canvas id="myCanvas3" width="250px" height="150px" style="border:1px solid red"></canvas>
<script>
let canvas1 = document.getElementById("myCanvas3").getContext("2d")
canvas1.fillStyle="blue";
canvas1.fillRect(25,25, 200,100);
</script>
<hr>
<center>
<h3>Drawing circle on Canvas</h3>
</center>
<canvas id="myCanvasCircle" width="200" height="200" style="border:1px solid green"></canvas>
<script>
let canvas2 = document.getElementById("myCanvasCircle").getContext("2d")
canvas2.fillStyle="red";
canvas2.arc(100,100,90,0, 2*Math.PI);
canvas2.fill();
canvas2.stroke();
</script>
<hr>
<center>
<h3>Drawing text on canvas</h3>
</center>
<canvas id="myCanvas" width="578" height="200" style="border:1px solid red;"></canvas>
<script>
let canvas3 = document.getElementById("myCanvas").getContext("2d");
canvas3.font='40pt Times New Roman';
canvas3.fillStyle="blue";
canvas3.fillText('Hello HTML-5', 150, 100);
</script>
</body>
</html>