The basic knowledge of SVG in Html5+svg Learning Guide

Source: Internet
Author: User

Baidu Encyclopedia:

SVG Scalable Vector Graphics (Scalable vector Graphics) is a graphical format for describing two-dimensional vector graphics based on Extensible Markup Language (XML). SVG is a new two-dimensional vector graphic format and a standard of network vector graphics in the standard. SVG strictly conforms to XML syntax and uses descriptive language in text format to describe image content, so it is a vector graphic format independent of image resolution.

What is SVG?

SVG refers to scalable vector graphics (Scalable vector Graphics)
SVG is used to define vector based graphics for the network
SVG uses XML format to define graphics
SVG images will not lose their graphic quality when zooming in or changing size
SVG is the standard of the World Wide Web Consortium
SVG and the standards of the global consortium, such as DOM and XSL, are a whole

The difference between Canvas and SVG:
Svg
SVG is a language that uses XML to describe 2D graphics.
SVG is xml-based, which means that every element in the SVG DOM is available. You can attach a JavaScript event handler for an element.
In SVG, each drawn graphic is treated as an object. If the properties of the SVG object change, the browser can reproduce the graphic automatically.
Characteristics:
Non-dependent resolution
Support Event handlers
Best for applications with large rendering areas (Google Maps, for example)
High complexity slows down rendering (any application that uses DOM too much is not fast)
Not suitable for game application
Canvas
Canvas uses JavaScript to draw 2D graphics.
Canvas is rendered in pixels.
In canvas, once the graphic has been drawn, it will not continue to get the attention of the browser. If its position changes, the entire scene needs to be redrawn, including any object that may have been covered by the graphic.
Characteristics:
Dependent resolution
Event Processor not supported
Weak text rendering capabilities
Ability to save the resulting image in. png or. jpg format
Ideal for image-intensive games, where many of the objects are frequently redrawn

SVG Example:
The code is as follows:




<svg width= "100%" height= "100%" >


<circle cx= "cy=" r= "stroke=" "#ff0" stroke-width= "3" fill= "Red"/>


</svg>

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.