BLOG

HTML5 Canvas feature, add Graphics, Videos, Animations to your website

The HTML5 Canvas is one of the more interesting HTML 5 features. It is one of the key elements which has lead to the HTML5 versus Flash debate.

Though still in its infancy, HTML5 Canvas holds a lot of promise for displaying animations, videos and graphics in devices not supporting Flash.

Where Flash is supported, it is still deemed superior to HTML5 Canvas for complex animations according to some tests.

The HTML5 Canvas element

The Canvas element allows for dynamic, script based rendering of 2D images and bitmap drawings. The Canvas tag is basically a rectangular area situated in the web page. You draw in this area using JavaScript.

Using the Canvas element

The rectangular region is defined in HTML with height and width attributes. JavaScript is then utilized to access the area through a full set of drawing functions.

Some of the drawing functions available are

  • Drawing Tools: Rectangles, Arcs, paths and line drawing
  • Effects: Fills and strokes, shadows, color gradients, text images, alpha transparency and compositing.
  • Transformations: Scaling, rotation, translation, transformation matrix
  • Inserting external images by URL
  • Pixel based manipulations
  • Retrieving a PNG representation of the current canvas as a data URI

These can be used to put together some great stuff.

Canvas element application

The HTML5 canvas element is used to create

  • Graphs and Charts
  • Animations
  • Games
  • Diagrams
  • Videos and Photo galleries
  • Special image effects
  • Drawing applications
  • User interface enhancements

Browser Support for HTML5 Canvas

HTML5 Canvas was first introduced by Apple for the Mac OS X Dashboard and later implemented in the Safari browser. All major browsers including Mozilla Firefox, Google Chrome and Opera have followed suit. Internet Explorer 8 does not provide support though Internet Explorer 9 will be fully supporting HTML5.

Future of HTML5 and the Canvas element

The HTML5 Canvas element is especially important for New age gadgets like IPads and IPhones which do not support Flash. With the increasing support for HTML5 across major websites and in Browsers, the Canvas element will only grow in importance. Next in the pipeline is a 3D Canvas for more complex displays.

Related Posts

HTML5 and the Geolocation feature
How HTML5 transforms offline web application use and browsing

Posted by Dharne & Co., a leading website design company based near Irvine, California.

TAGS > , ,

Post a comment

eleven + 3 =