What is the difference between svg and canvas | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference between svg and canvas

22nd Apr 2019, 9:21 PM
Kudakwashe Mbata
Kudakwashe Mbata - avatar
4 Answers
+ 5
Both of them are use for drawing and animation. Canvas draw with pixels via JavaScript while SVG uses vector directly via HTML. https://www.sololearn.com/learn/HTML/2202/?ref=app
22nd Apr 2019, 9:32 PM
Edwin
Edwin - avatar
+ 3
Canvas: - objects are drawn programmatically - drawing based on pixels - animation is not built - fast pixel-based drawing operations - need to take into account the resolution - no support for event handlers - the ability to save the resulting image in .png or .jpg format - well suited for games with complex graphics Svg: - elements are part of the DOM (Document Object Model) model - drawing by using vectors - built-in effects, such as animation - based on more understandable standard XML syntax - no need to take permission into account - implemented support for event handlers - not suitable for gaming applications - best suited for applications with a large display area (for example, Google Maps)
22nd Apr 2019, 9:29 PM
Solo
Solo - avatar
+ 2
Thank you
22nd Apr 2019, 9:30 PM
Kudakwashe Mbata
Kudakwashe Mbata - avatar