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

Custom Search