What is the difference between SVG and HTML5 Canvas?

前端 未结 10 2098
误落风尘
误落风尘 2020-11-30 18:08

What are the differences between SVG and HTML5 Canvas? They both seem to do the same to me. Basically, they both draw vector artwork using coordinate points.

What am

10条回答
  •  孤独总比滥情好
    2020-11-30 19:03

    SVG

    Based on use case SVG is used for logos, charts because its vector graphics you draw and forgot about it. When view port change like re-sizing(or zoom) it will adjust itself and no need to redraw.

    Canvas

    Canvas is bitmap (or raster) it done by painting of pixels to the screen. It is used to develop games or graphics experience (https://www.chromeexperiments.com/webgl) in a given area it paints pixel and changes by redraw it another. Since its a raster type we need to redraw entirely as view port changes.

    Reference

    http://www.sitepoint.com/7-reasons-to-consider-svgs-instead-of-canvas

    http://en.wikipedia.org/wiki/WebGL

    http://vector-conversions.com/vectorizing/raster_vs_vector.html

提交回复
热议问题