+ 6

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.

9th Jan 2018, 10:23 PM
Matúš Semančík
Matúš Semančík - avatar
7 Réponses
+ 9
Definitely. With SVG one character will be ok. 30 would have so much lag that the game would be unplayable.
9th Jan 2018, 10:55 PM
jay
jay - avatar
+ 9
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/
9th Jan 2018, 10:26 PM
jay
jay - avatar
+ 9
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!
9th Jan 2018, 10:51 PM
jay
jay - avatar
+ 5
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.
9th Jan 2018, 10:44 PM
Matúš Semančík
Matúš Semančík - avatar
+ 4
Thank you so much!
9th Jan 2018, 10:55 PM
Matúš Semančík
Matúš Semančík - avatar
+ 3
Okay, so definitively canvas?
9th Jan 2018, 10:53 PM
Matúš Semančík
Matúš Semančík - avatar
+ 2
Use pixi.js. Definitely the best library for canvas drawing.
24th Jan 2018, 10:07 PM
Michael Absolon
Michael Absolon - avatar