© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
J. MeyerThe Essential Guide to HTML5https://doi.org/10.1007/978-1-4842-8722-4_2

2. Dice Game

Jeanine Meyer1  
(1)
Purchase, NY, USA
 
In this chapter, we cover the following:
  • Drawing on a canvas

  • Random processing

  • Game logic

  • Form output

Introduction

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, ...

Get The Essential Guide to HTML5: Using Games to Learn HTML5 and JavaScript 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.