Canvas
<canvas> element is used to draw graphics using JavaScript. <canvas> element is only a container to hold the graphics. You must script it to draw the actual graphic.
A canvas is a rectangular area on an HTML page.
<canvas id="myCanvas" width="200" height="100"
style="border:1px solid
#000000;">
</canvas>
Using JavaScript you can manipulate the canvas
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.fillStyle = "#FF0000";
svg
SVG stands for Scalable vector graphics. They are used to define vector-based graphics for web. SVG defines the graphics in XML format.
SVG images can be created and edited using any text editor and they can be searched, indexed. SVG images are scalable so it can be printed in high quality at any resolution.
You now see that in HTML5 graphics there are 2 ways you can go with either Canvas or SVG. comparison between these 2 will be good in understanding which is better
0 comments:
Post a Comment