Canvas: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 17: Line 17:


  p.fillRect(0, 0, 100, 100);
  p.fillRect(0, 0, 100, 100);
== Tutorials & Reference ==
* http://developer.mozilla.org/en-US/docs/Canvas_tutorial
* http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html

Revision as of 16:27, 24 September 2012

The canvas tag was introduced by Apple and has been standardized to become part of HTML5.

A simple example page...

A example for color cycling with the canvas element [[1]]


Get the canvas tag:

c=document.getElementById("c")

Get the "context" (like a paper):

p=c.getContext("2d");

Draw something!

p.fillRect(0, 0, 100, 100);

Tutorials & Reference