© Jeanine Meyer 2018
Jeanine MeyerThe Essential Guide to HTML5https://doi.org/10.1007/978-1-4842-4155-4_2

2. Dice Game

Jeanine Meyer1 
Purchase, NY, USA
In this chapter, we cover
  • Drawing on canvas

  • Random processing

  • Game logic

  • Form output


Among the most important new features in HTML5 is the canvas element . This element provides a way for developers to make line drawings, include images, and position text in a totally free-form fashion, a significant improvement over the older HTML. Although you could do some fancy formatting in the earlier versions, layouts tended to be boxy and pages less dynamic. How do you draw on the canvas? You use a scripting language, usually JavaScript. I will show you how to draw on canvas and I’ll explain ...

Get The Essential Guide to HTML5: Using Games to Learn HTML5 and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.