HTML and CSS Reference
In-Depth Information
Figure 5-19. A ball moving on a vector with gravity and a bounce applied
NOTE
To achieve a nice-looking bounce for this example, we also changed the angle of the vector in can-
vasApp() to 295 :
var
var angle = 295 ;
Example 5-15 offers the full code.
Example 5-15. Simple gravity with a bounce
<!doctype html>
<html
<html lang= "en" >
<head>
<head>
<meta
<meta charset= "UTF-8" >
<title>
<title> CH5EX15: Gravity With A Bounce </title>
</title>
< script src = "modernizr.js" >< /script>
< script type = "text/javascript" >
window . addEventListener ( 'load' , eventWindowLoaded , false
false );
function
function eventWindowLoaded () {
canvasApp ();
Search WWH ::




Custom Search