This repository has been archived by the owner on Dec 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathslide_06.html
executable file
·70 lines (63 loc) · 2.53 KB
/
slide_06.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link href="./images/favicon.ico" rel="shortcut icon">
<link href="css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="javaScript/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="javaScript/main.js"></script>
</head>
<body>
<header>
<h1>Let's draw a circle</h1>
</header>
<div style="height:8px;" class="blackLine"></div>
<section class="code">
<pre>
<script type="text/javascript">
$(window).load(animationExampleInit);
<span class="highlight">//global variable...ew
var canvasContext;</span>
function animationExampleInit(e){
canvasContext = $("#myCanvas")[0].getContext("2d");
<span class="highlight">drawBall();</span>
}
<span class="highlight">function drawBall(){
canvasContext.beginPath();
//arc(x coordinate, y coordinate, Arc radius,
// Starting point on circle, End point on circle, is counterclockwise);
//Math.PI == 3.141592653589793 radians, which is half of a revolution around a circle
canvasContext.arc(50, 50, 20, 0, Math.PI*2, false);
canvasContext.closePath();
canvasContext.fill();
}</span>
</script>
</pre>
</section>
<canvas width="600px" height="300px" id="myCanvas">your browser does not support canvas tag jackleg!</canvas>
<script type="text/javascript">
$(window).load(animationExampleInit);
//global variable...ew
var canvasContext;
function animationExampleInit(e){
canvasContext = $("#myCanvas")[0].getContext("2d");
drawBall();
}
function drawBall(){
canvasContext.beginPath();
//arc(x coordinate, y coordinate, Arc radius,
// Starting point on circle, End point on circle, is anticlockwise);
//Math.PI == 3.141592653589793 radians, which is half of a revolution around a circle
canvasContext.arc(50, 50, 20, 0, Math.PI*2, false);
canvasContext.closePath();
canvasContext.fill();
}
</script>
<nav>
<a id="left_btn" href="slide_05.html">Previous</a>
<a id="right_btn" href="slide_07.html">Next</a>
</nav>
</body>