Html5 Book

HTML5, the latest version of HTML, the formatting language that produces web pages - including the one you read this on, of course - has taken the web development community by storm.

On one hand, it is easy to learn; On the other hand, it has the potential to evolve and then pose a serious threat to Flash, which is more or less synonymous with impressive animations.

HTML5 has come about thanks to the cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG), in their collective pursuit to make the web a true treasure trove for mankind.

In this tutorial, you will:

  • Learn to create and amazingly simple, yet powerful and exciting game.
  • Play it as a challenge with your loved ones.

Finding a good book to master HTML5 can be very challenging: there are so many around - most with eye-catching titles and very complex substance.
Therefore, Vivax Solutions strongly recommends Core HTML5 Canvas for those who really want to delve into HTML5.
Please click the image to access Amazon:

Creating 2-D Animations on Canvas

Interactive Coin Game

In this game, you can drag and drop a coin at three different places to invert a triangle. The movement is restricted to just three moves.

The element, img, is made draggable by making the property true.

Then onDrag(), onDropOver() and onDrop() events are manipulated to produce the desired effect.

Since the game allows a user to make three attempts, after dragging a coin three times, the programme holts - until the page is refreshed to make another attempt.

// global variable to store the number of dragging
h = 0;
// invoked above the place where coin is dropped - just before the event
function allowDrop(ev) {
// blocking the default event - inability to drop
// invoked when dragging starts
function drag(ev) {
// stores the data of the object being dragged
// invoked when dropping the image
function drop(ev) {
h = h + 1;
if (h <= 3) {
// getting the data of the object to be dropped
var data = ev.dataTransfer.getData("Text");;
else {
alert('Only 3 moves allowed; refresh the page for a new attempt.');

<-Go to Tenth Lesson Go to Twelveth Lesson->