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
/
slide_10.html
executable file
·66 lines (59 loc) · 2.07 KB
/
slide_10.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
<!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>Woot!</h1>
</header>
<div style="height:8px;" class="blackLine"></div>
<canvas width="600px" height="300px" id="myCanvas">your browser does not support canvas tag jackleg!</canvas>
<script type="text/javascript">
$(window).load(animationExampleInit);
var canvasContext;
var xVal = 50;
var yVal = 50;
var xVelocity = 5;
var yVelocity = 2.2;
function animationExampleInit(e){
canvasContext = $("#myCanvas")[0].getContext("2d");
drawBall();
startBall();
}
function drawBall(){
clearCanvas(canvasContext);
canvasContext.beginPath();
canvasContext.arc(xVal, yVal, 20, 0, Math.PI*2, false);
canvasContext.closePath();
canvasContext.fill();
setTimeout(animateBall, 33);
}
function startBall(){
setTimeout(animateBall, 33);
}
function animateBall(e){
xVal += xVelocity;
yVal += yVelocity;
drawBall();
}
function clearCanvas(cxt, regPoints) {
var regPoints = $.extend({
x: 0,
y: 0
}, regPoints||{});
cxt.clearRect(regPoints.x, regPoints.y, cxt.canvas.width, cxt.canvas.height);
}
</script>
<nav>
<a id="left_btn" href="slide_09.html">Previous</a>
<a id="right_btn" href="slide_11.html">Next</a>
</nav>
</body>