HTML and CSS Reference
In-Depth Information
What we are doing:
New path
Position
before
correction
Position
after
correction
Boundary
Position
before
moving
Path of ball
Real-world situation:
Never
gets here
New path
Position
of impact
Boundary
Position
before
moving
Path of ball
Figure 6-5. This technique isn't perfect, but is quick, easy, and close enough for most situations.
Determining the correct position takes more complex calculations. Although you are free to figure out how
to do this (using the trigonometry covered in Chapter 3), you won't notice much of a difference in most
situations. For almost any game or visual effect you create for the canvas element, this method will serve
you just fine. However, you can add one more thing to take the realism just a notch higher.
Search WWH ::




Custom Search