-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcanvas-experiments.html
More file actions
61 lines (54 loc) · 2.31 KB
/
canvas-experiments.html
File metadata and controls
61 lines (54 loc) · 2.31 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
60
<!--
http://devhammer.net/blog/exploring-html5-canvas-part-3---paths-and-text
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Canvas Experimental Page</title>
<style type="text/css">
html { background: transparent url('webx-bkg.png') repeat-x; margin: 0; padding: 0; }
body { font-family: "Segoe UI", Tahoma, Helvetica, Arial, Sans-Serif; margin: 0; padding: 0; line-height: 150%; background: transparent url('webx-content-bkg.jpg') no-repeat center top; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; color: #434343; }
.container { width: 800px; margin: 0 auto 0 auto; padding: 40px 0 0 0; }
</style>
</head>
<body>
<div class="container">
<canvas id="myCanvas" width="500" height="500">
<p>Canvas is not supported by your browser.</p>
</canvas>
</div>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var canvas = $('#myCanvas').get(0);
var context = canvas.getContext("2d");
function renderContent() {
context.fillRect(0, 0, canvas.width, canvas.height);
context.strokeStyle = "#FF0000"
context.lineWidth = 7;
context.lineCap = "round";
context.lineJoin = "round";
// draw rectangle using line
context.moveTo(200, 200);
//context.lineTo(300, 300);
//
// The only difference between
// bezierCurveTo and quadraticCurveTo is that
// the latter only has one control point, rather than two.
context.bezierCurveTo(200,200, 300,200, 300,300);
context.lineTo(300, 200);
context.lineTo(200, 200);
context.stroke();
context.fillStyle = "#00FF00";
context.fill();
context.lineWidth = 2;
context.strokeStyle = "#00F0FF";
context.font = "14px sans-serif";
context.strokeText("Hello, Canvas!", 200, 300);
}
renderContent();
});
</script>
</body>
</html>