-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcanvas-experiments-2.html
More file actions
53 lines (47 loc) · 1.97 KB
/
canvas-experiments-2.html
File metadata and controls
53 lines (47 loc) · 1.97 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
<!--
http://devhammer.net/blog/exploring-html5-canvas-part-2---basic-shapes
-->
<!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.fillStyle = "#FF0000";
context.fillRect(5, 5, 200, 100);
context.strokeStyle = "#00ff00";
context.strokeRect(5, 5, 200, 100);
// draw a circle with context.arc
context.lineWidth = 3;
context.fillStyle = "#0000FF";
context.strokeStyle = "#FF0000";
context.beginPath();
//context.arc(155, 155, 42, Math.PI, Math.PI * 2, false);
context.arc(155, 155, 42, 0, Math.PI * 2, false);
context.closePath();
context.fill();
context.stroke();
}
renderContent();
});
</script>
</body>
</html>