Download presentation
Presentation is loading. Please wait.
Published byBlaze Warner Modified over 8 years ago
1
Part – 3 : HTML 5 SVG Tag
3
† 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
4
† 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
5
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
6
How to Embed SVG Directly Into HTML Pages
7
† 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
8
† 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
9
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
10
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.
11
SVG Rectangle OUTPUT :
12
SVG Rectangle Opacity OUTPUT :
13
SVG Rounded Rectangle OUTPUT :
14
SVG Eclipse OUTPUT :
15
SVG Eclipses on Each Other OUTPUT :
16
SVG Line OUTPUT :
17
SVG Polygon with Three Side OUTPUT :
18
SVG Polygon with Four Side OUTPUT :
19
SVG Star OUTPUT :
20
SVG Star of Even Odd Fill OUTPUT :
21
SVG Poliline OUTPUT :
22
SVG Another Poliline OUTPUT :
23
SVG Path OUTPUT :
24
†Here we end.. †In the next section, we will continue with other basic shape example. †To be continue… To be continue..
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.