This article is translated from: Http://dev.opera.com/articles/view/html-5-canvas-the-basics
Briefly
The HTML 5 specification introduces many new features, one of the most anticipated of which is the canvas element. HTML 5 Canvas
CanvasThe canvas element is the element of the new home of HTML5, which is responsible for setting an area in the page, which can then be used to dynamically draw graphics in this area via JavaScriptBasic usageWhen you use a canvas element, you must first set its width properties and height properties to specify the size of the drawing area. The content that appears in the
Improve the Performance of HTML5 Canvas,
For details, click
I. Use cache technology to implement pre-drawing and reduce repeated Canvs content painting
Most of the time we draw and update on the Canvas, there will always be some unchanged content, for this content
Cache should be drawn in advance, rather than every refresh.
Directly draw the Code as follows:
cont
In the The code is as follows:
Your Browser does not support HTML5.
For canvas, the following wording is not allowed:
The code is as follows:
Let's take a look at what this code does. The
1.id. We can use the ID value in the JavaScript code to reference the 2.width. The width of the canvas, in pixels. In the above code, the width value is 500 pixels.3.height. The height of the
browser only needs to be drawn once to form a picture.
Using only one Canvas DOM element, reducing the number of DOM and rendering complexity, can turn the original CPU-intensive into GPU operations. The vast majority of Canvas is accelerated rendering with hardware GPU.
The ALU (computational unit) of the GPU is much more than the CPU, while the control operation (logic) can be done in the CP
For special effect performance, which of canvas, css3, and jquery is more suitable for mobile phones? Recently, I used dom + jquery to create a mobile application with 6 pages, some of which have effects such as gear rotation and the running of stars. After doing well, I found that the performance was really poor, then I changed it to the structure of css3 +
to implement animation components using canvas.
User interface
Although canvas may have impressive graphics performance, it is not always the best choice for rich UIs; HTML elements may be more appropriate. Many rich Internet applications contain a variety of components, each with different uses and requirements. Th
Directory
Briefly
Canvas Basics
The context API
Basic lines
Path
Inserting images
Pixel-level operation
Text
Shadow
Color Gradient
Section
BrieflyThe HTML 5 Specification introduces many new features, one of the most anticipated is the canvas element.
Directory
Brief Introduction
Canvas Basics
2d context API
Basic Line
Path
Insert Image
Pixel-level operations
Text
Shadow
Color gradient
Section
Brief Introduction
Html5. Specifications introduce many new features, one of the most promising ones iscanvasElement. HTML 5canvasIt provides a method for Drawing Images through JavaScript, which is simple but powerful. EverycanvasE
1. What is canvasCanvas is a canvas that can draw any line, graph, fill, and so on. All of this is done with JS, and the canvas provides not only a simple two-dimensional vector drawing, but also a series of API support including three-dimensional drawing and image processing.Create a canvas label Create a canvas eleme
Today, I tried to simulate an HTML web game, which is very simple. Directly run the Code:
HTML files are simple:
The game. js file is as follows:
// 1. create a canvasvar canvas = document. createelement ("canvas"); // create a canvas var CTX =
HTML5 canvas performance circle, html5canvas circle
This article focuses on the Performance of HTML5 canvas. The scenario is to draw circles on the canvas.
I 've been trying to use HTML5 canvas to draw bubbles on a Christmas tre
HTML5 canvas Performance
This article focuses on the Performance of HTML5 canvas. The scenario is to draw circles on the canvas.
I 've been trying to use HTML5 canvas to draw bubbles on a Christmas tree image. Because I don't kno
HTML 5 Canvas Reference Manual
HTML Video/Audio
HTML Document Type
DescribeHTML5 However, the,The GetContext () method returns an object that provides methods and properties for drawing on the canvas.This manual provides complete getcontext ("2d") object properties and methods that you can use to draw
Canvas is the new standard solution for developing cross-platform animations and games in HTML, enabling pixel-level manipulation of images and video.First, add a canvas element to the pageJust like adding a normal div, the canvas is added as follows:You can use CSS to add styles to a
The overall steps of canvas drawing:1. Create HTML page, set canvas label2. Write JS to get the canvas DOM object3. Get context through the canvas tag DOM object4. Set drawing line style, color5. Draw a graphic, or fill a graphicBrowser support:Internet Explorer 9, Firefox,
DOCTYPE HTML>HTMLLang= "en">Head> MetaCharSet= "UTF-8"> title>Documenttitle>Head>Body> CanvasID= "Canvas"style= "margin:0 auto;border:1px #ddd Solid">the current browser does don't support Canvas, can replace the browser a try! Canvas> Script> varCanvas=document.getElementById ('
Implement "fingerprint recognition" technology based on HTML Canvas
Description
Fingerprint Recognition refers to the unique identifier (UUID) of each device ). For example, mobile native apps can call related device APIs to obtain the corresponding UUID. However, the WebAPP in the browser is restricted by the running environment and cannot directly guard against the API of the local device. In this case,
years//Setcookie (' uuid ', uuid, 732 * *);DisadvantagesThe UUID can then be used to implement the user tracking technology and facilitate the subsequent data analysis work.But with the Internet's emphasis on personal privacy, cookies are becoming more and more unpopular. Many security tools, even browsers, begin to allow or direct users to turn off cookies, such as a "privacy mode" feature in many major browsers. This makes it difficult for websites to track user behavior through cookies. Howe
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.