HTML and CSS Reference
In-Depth Information
Figure 5-21. Ball bouncing with gravity, elasticity, and friction applied
Example 5-17
gives the full code for
CH5EX17.html
, the final code of our simple gravity,
simple elasticity, and simple friction example.
Example 5-17. Gravity with a vector with bounce friction
<!doctype html>
<html
<html lang=
"en"
>
<head>
<head>
<meta
<meta charset=
"UTF-8"
>
<title>
<title>
CH5EX17: Gravity With A Vector With Bounce Friction
</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
;
}
function
function
canvasApp
() {