Building the Application and Making It Your Own
The two applications for simulating the bouncing of a video clip ball in a two-dimensional box contain similar code, as does the program that produced the picture of the trajectory. A quick summary of the applications follows. The video applications are summarized by the following:
init
: initialization, including adapting to fit the window and setting up the timed event for invokingdrawscene
drawscene
:- Erase the canvas.
- Determine new location of video (virtual ball) using
moveandcheck
. - Either draw the image from video at a specified location on the canvas or reposition the video element to a specified position.
- Draw paths on canvas to act as a mask to the video.
- Draw the box.
moveandcheck
Get HTML5 and JavaScript Projects now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.