title: Core HTML5 Canvas: Graphics, Animation, and Game Development (Core Series)
author: David Geary
description: <span>"The HMTL5 canvas has long needed a thoughtful and thorough presentation -- and this is that book...</span>In many ways, this book reminds me of the old-style tutorials we all miss: complete, approachable, with high production values in the publication process... An excellent volume." <i>- <b>Dr. Dobbs </b></i><br /><br /><span><i>"</i></span><span>Core</span><i><span>HTML5 Canvas: Graphics, Animation, and Game Development</span></i><span>is a terrific guide to building HTML5 games using the Canvas object...</span>It is a beautifully-presented guide to drawing using the Canvas object, with a focus on game development." <i>- <b>gamedev.net</b></i><br /><br />"This comprehensive book covers all you need to know about the HTML5 canvas element so that you can build robust online games for desktop and mobile devices. I learned more about the canvas element from this book than I learned from any other resource, online or off. I have reviewed other canvas books, and most of them are very good, but this one is great." <i>- <b>About.com </b></i><br /><br /><span>"This was a delightful book that will help readers understand the finer points of developing games in HTML5's canvas element. While it doesn't get you to the point of developing three dimensional blockbuster games inside the browser, it does bite off a very manageable chunk for most readers. And, if you're a developer looking to get into HTML5 game design, I heavily recommend this text as an introduction". -<b><i> slashdot.org</i></b></span>
zlib_text: # Part I  
  Drawing
  
  
  Drawing
  
  The HTML canvas element, true to its name, provides a blank canvas on which we
  can draw our game. Drawing is a fundamental aspect of working with the HTML
  canvas element, so in these first few chapters we will explore how drawing
  works and learn the fundamentals necessary to draw our own designs with simple
  lines and fills. We will also develop some of the game elements necessary for
  our Asteroids game clone.
  
  
  
  
  
  © Graeme Stuart 2017
  
  Graeme StuartIntroducing JavaScript Game Development
  [https://doi.org/10.1007/978-1-4842-3252-1_1](A455241_1_En_1_Chapter.html)
  
  # 1\. HTML5 and the Canvas Element
  
  Graeme Stuart1
  
  (1)
  
  Market Harborough, Leicestershire, UK
  
  This chapter introduces some of the basics of HTML, CSS, and JavaScript. These
  are the core web technologies, and we’ll use them for developing our game
  throughout this book. In order to follow along, you’ll need a text editor to
  generate text files and a web browser to view the results with.
  
  You won’t 