Canvas (HTML element)
From Wikipedia, the free encyclopedia
The canvas element is a third party extension to the HTML standard that allows for dynamic rendering of scriptable bitmap images.
It was initially introduced by Apple for use inside their own Mac OS X Webkit component, powering applications like Dashboard widgets and the Safari browser. Later, it was adopted by Gecko browsers (notably Mozilla and Firefox) and standardized by the WHATWG on new proposed specifications for next generation web technologies. Support is also present in the Opera 9.0 browser . Novell manufactures an XForms processor plugin for Internet Explorer, which also provides support for the canvas element . Independent efforts to support the canvas feature on Internet Explorer do not require plugins and are based solely on VML and JavaScript. Google has also begun a project to add canvas abilities to Internet Explorer using the same techniques.
Canvas consists of a drawable region defined in HTML code with height and width attributes. JavaScript code may access the area through a full set of drawing functions similar to other common 2D APIs, thus allowing for dynamically generated graphics. Some anticipated uses of the canvas include building graphs, animations, and image composition.
Contents |
[edit] Reactions
At the time of its introduction the canvas element met with mixed reactions from the web standards community. Some complained about Apple's decision to create a new proprietary element instead of supporting the SVG standard, which still has not achieved broad web acceptance. Some others argued about the logic upon which canvas was conceived: being completely procedural and not having a descriptive counterpart allowed canvas to 'paint', but drawn elements are not identifiable in a DOM-like way. Other people raised concerns, not about the proprietary extension per se, but in regard to the proposed syntax for those elements. For example, they consider the absence of a namespace indication to be undesirable.
A web developer unsatisfied by the level of SVG support in Safari has pushed himself to develop an SVG Tiny 1.2 to canvas rasteriser in JavaScript, as a proof of concept against claims that canvas was a lot easier to implement in Safari than a complete SVG integration.
[edit] Notes
- ↑ Opera 9.0 changelog
- ↑ Novell XForms Explorer
- ↑ Canvas in IE
- ↑ Google's Canvas in IE project
- ↑ Ian Hickson remarks regarding canvas and other Apple extensions to HTML
- ↑ canvaSVG Javascript object for rendering SVG documents in canvas
[edit] Examples
- Great Web Wall - Live Internet wall implemented with Canvas element.
- Canvascape - A 3D game implemented with Canvas.
- ColorJack - Color theory using Canvas.
- Various demos - Various canvas demos (a chart, a live server monitor, a Lindenmayer system implementation)
- Fractals - An example of fractals rendering
- Frames - Drawing decorative borders around standard HTML elements
- Tucanos - The tucanos demo
- Free drawing - Free drawing example
- Conway's Game of Life - the widely-known cellular automaton implemented using Canvas.
- Canvas Pong - A pong recreation using the canvas tag.
- Canvas Painter - A simple canvas-based paint demo using widgets.
- Canvas plasma demo - Simple port of a C plasma demo
- Breakout using canvas -The classic game, Breakout, using the canvas tag.
- jsMSX (demo) - MSX Emulator 100% written in Javascript.
- PlotKit - A number of charting examples with a toolkit.
- JS Arkanoid - An arkanoid clone using canvas.
- Unreal Soccer - Soccer game that uses canvas
- LSys/JS - Interactive L-System interpreter using canvas.