HTML and CSS Reference
In-Depth Information
}
}
When you load
Example 5-5
in your web browser, you will see a bunch of balls all moving
aroundthescreenindependently,asshownin
Figure 5-7
.Forthefunofit,whynotchangethe
numBalls
variable to 500 or 1,000? What does the canvas look like then?
Figure 5-7. Multiple balls of different sizes bouncing off walls
Example 5-5. Multiple ball bounce
<!doctype html>
<html
<html lang=
"en"
>
<head>
<head>
<meta
<meta charset=
"UTF-8"
>
<title>
<title>
CH5EX5: Multiple Ball Bounce
</title>
</title>
<
script src
=
"modernizr.js"
><
/script>
<
script type
=
"text/javascript"
>
window
.
addEventListener
(
'load'
,
eventWindowLoaded
,
false
false
);
function
function
eventWindowLoaded
() {
canvasApp
();
}
function
function
canvasSupport
() {
return
return
Modernizr
.
canvas
;