SVG or Canvas | Sololearn: Learn to code for FREE!

+5

SVG or Canvas

Hi, I am working on online browser game and I have a little problem... In this game will be used many animations and effects. Should i use Canvas for rendering objects or SVG? I read some articles about this problem. SVG is supposedly slow, but I cannot imagine animations in Canvas. Thanks for help.

1/9/2018 10:23:07 PM

Matúš Semančík

7 Answers

New Answer

+9

Definitely. With SVG one character will be ok. 30 would have so much lag that the game would be unplayable.

+10

Do you remember these lessons? I think they will answer your questions. https://www.sololearn.com/learn/HTML/2202/ https://www.sololearn.com/learn/HTML/2203/

+8

Yes, I would be looking at objects for this, it will make creation and management much easier. https://www.sololearn.com/learn/JavaScript/1152/?ref=app Nice Character!

+4

Thank you for response. This methods can rotate, translate and scale canvas... So I need function, which will calculate positions and rotations of each element (e.g. 30 players, each player has character - head, legs, arms...) and in interval draw these elements? I have prototype using svg ( http://ageofdanrolius.herokuapp.com/character.html ). You can look at it.

+4

Okay, so definitively canvas?

+4

Thank you so much!

+2

Use pixi.js. Definitely the best library for canvas drawing.