Download ppt - Part 3 - HTML 5 svg tag

Transcript
Page 1: Part 3 - HTML 5 svg tag

Part – 3 : HTML 5 SVG TagPart – 3 : HTML 5 SVG Tag

Page 3: Part 3 - HTML 5 svg tag

† SVG stands for Scalable Vector Graphics.

† SVG is used to define vector-based graphics for the Web.

† SVG defines the graphics in XML format.

† SVG graphics do NOT lose any quality if they are zoomed or resized.

What is SVG Tag

Page 4: Part 3 - HTML 5 svg tag

† Every element and every attribute in SVG files can be animated.

† SVG is recommended by W3C.

† NOTE : HTML5 has support for inline SVG.

What is SVG Tag

Page 5: Part 3 - HTML 5 svg tag

Advantages of using SVG over other image formats (like JPEG and GIF) are:

† SVG images can be created and edited with any text editor.

† SVG images can be searched, indexed, scripted, and compressed.

† SVG images are scalable† SVG images can be printed with high quality at any resolution.† SVG images are zoomable (and the image can be zoomed without degradation).

Advantages of SVG

Page 6: Part 3 - HTML 5 svg tag

How to Embed SVG Directly Into HTML Pages

Page 7: Part 3 - HTML 5 svg tag

† SVG is a language for describing 2D graphics in XML.

† Canvas draws 2D graphics, on the fly (with a JavaScript).

† SVG is XML based, which means that every element is available within the SVG DOM. You can attach

JavaScript event handlers for an element.†

Differences Between SVG and Canvas

Page 8: Part 3 - HTML 5 svg tag

† In SVG, each drawn shape is remembered as an object. If attributes of an SVG object are changed, the browser can automatically re-render the shape.

† Canvas is rendered pixel by pixel. In canvas, once the graphic is drawn, it is forgotten by the browser. If its position should be changed, the entire scene needs to be redrawn, including any objects that might have

been covered by the graphic.

Differences Between SVG and Canvas

Page 9: Part 3 - HTML 5 svg tag

Comparison of Canvas and SVG

† Resolution dependent† No support for event handlers† Poor text rendering capabilities† You can save the resulting image as .png or .jpg† Well suited for graphic-intensive games

† Resolution independent† Support for event handlers† Best suited for applications with large rendering areas (Google Maps)† Slow rendering if complex (anything that uses the DOM a lot will be slow)† Not suited for game applications

Page 10: Part 3 - HTML 5 svg tag

SVG Other Basic Shapes

† SVG defines graphics in XML format.

† We saw an example about SVG circle, but there are some other basic shapes like rectangle, eclipse,

polygon, star, polyline, path, curve, text and line.

† We will see all the shapes one by one here.

Page 11: Part 3 - HTML 5 svg tag

SVG Rectangle

OUTPUT :

Page 12: Part 3 - HTML 5 svg tag

SVG Rectangle Opacity

OUTPUT :

Page 13: Part 3 - HTML 5 svg tag

SVG Rounded Rectangle

OUTPUT :

Page 14: Part 3 - HTML 5 svg tag

SVG Eclipse

OUTPUT :

Page 15: Part 3 - HTML 5 svg tag

SVG Eclipses on Each Other

OUTPUT :

Page 16: Part 3 - HTML 5 svg tag

SVG Line

OUTPUT :

Page 17: Part 3 - HTML 5 svg tag

SVG Polygon with Three Side

OUTPUT :

Page 18: Part 3 - HTML 5 svg tag

SVG Polygon with Four Side

OUTPUT :

Page 19: Part 3 - HTML 5 svg tag

SVG Star

OUTPUT :

Page 20: Part 3 - HTML 5 svg tag

SVG Star of Even Odd Fill

OUTPUT :

Page 21: Part 3 - HTML 5 svg tag

SVG Poliline

OUTPUT :

Page 22: Part 3 - HTML 5 svg tag

SVG Another Poliline

OUTPUT :

Page 23: Part 3 - HTML 5 svg tag

SVG Path

OUTPUT :

Page 24: Part 3 - HTML 5 svg tag

† Here we end..

† In the next section, we will continue with other basic shape example.

† To be continue…

To be continue..


Recommended