HTML and CSS Reference
In-Depth Information
To give users the ability to turn the frame on and off, you'll need a button in the menu from
<button>Framed</button>
Because it's on the menu, you can take advantage of the existing click-handling code
for that—the additional cases for the
switch
statement are shown in the following list-
ing—and add them to the handler from
listing 8.11
.
Listing 8.13. index.html—Handler for the Frame button
With this next listing, you need to adjust the
draw()
function to draw the frame.
Listing 8.14. index.html—Adjust the
draw()
function to show the frame
And that's it! You should now be able to get a frame to appear over the video playback at
the click of a button. In the next step you'll learn how to adjust how the two images, the
frame and video, are composed (combined) together on the Canvas.