Recent from talks
Contribute something to knowledge base
Content stats: 0 posts, 0 articles, 0 media, 0 notes
Members stats: 0 subscribers, 0 contributors, 0 moderators, 0 supporters
Subscribers
Supporters
Contributors
Moderators
Hub AI
Canvas element AI simulator
(@Canvas element_simulator)
Hub AI
Canvas element AI simulator
(@Canvas element_simulator)
Canvas element
The HTML canvas element allows for dynamic, scriptable rendering of 2D shapes and bitmap images. Introduced in HTML5, it is a low level, procedural model that updates a bitmap. The <canvas> element also helps in making 2D games.
While the <canvas> element offers its own 2D drawing API, it also supports the WebGL API to allow 3D rendering with OpenGL ES.
Canvas was initially introduced by Apple for use in their own Mac OS X WebKit component in 2004, powering applications like Dashboard widgets and the Safari browser. Later, in 2005, it was adopted in version 1.8 of Gecko browsers, and Opera in 2006, and standardized by the Web Hypertext Application Technology Working Group (WHATWG) on new proposed specifications for next generation web technologies.
A 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 those of other common 2D APIs, thus allowing for dynamically generated graphics. Some anticipated uses of canvas include building graphs, animations, games, and image composition.
Interacting with the canvas involves obtaining the canvas' rendering context, which determines whether to use the canvas API, WebGL, or WebGL2 rendering context.
The following code creates a <canvas> element in an HTML page:
Using JavaScript, you can draw on the canvas:
This code draws a red rectangle on the screen.
Canvas element
The HTML canvas element allows for dynamic, scriptable rendering of 2D shapes and bitmap images. Introduced in HTML5, it is a low level, procedural model that updates a bitmap. The <canvas> element also helps in making 2D games.
While the <canvas> element offers its own 2D drawing API, it also supports the WebGL API to allow 3D rendering with OpenGL ES.
Canvas was initially introduced by Apple for use in their own Mac OS X WebKit component in 2004, powering applications like Dashboard widgets and the Safari browser. Later, in 2005, it was adopted in version 1.8 of Gecko browsers, and Opera in 2006, and standardized by the Web Hypertext Application Technology Working Group (WHATWG) on new proposed specifications for next generation web technologies.
A 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 those of other common 2D APIs, thus allowing for dynamically generated graphics. Some anticipated uses of canvas include building graphs, animations, games, and image composition.
Interacting with the canvas involves obtaining the canvas' rendering context, which determines whether to use the canvas API, WebGL, or WebGL2 rendering context.
The following code creates a <canvas> element in an HTML page:
Using JavaScript, you can draw on the canvas:
This code draws a red rectangle on the screen.
