Answer the question
In order to leave comments, you need to log in
HTML5 GAME: Is it better to use Canvas or DIV for sprite animation?
Hello.
This is the question: I’m doing character animation on sprites, tell me if it’s worth using canvas and animating in it, or is it better to animate using css animation, that is, change the background-position and use @keyframes ?
What is the fundamental difference in both methods? Isn't css animation better than js in performance?
Answer the question
In order to leave comments, you need to log in
it really doesn't exist, but there is php.net/manual/en/function.preg-match-all.php
Canvas is many times faster than SVG and even more so DOM
CSS animation is built on DOM redrawing, it cannot be faster in any
way
Well, if you have the rest of the game on divas, then what's the point of fencing canvas for the sake of one animation?
Well, vice versa :)
Canvas and EasleJS / Phaser to help you. Well, or build your own kind of engine if you like cycling.
- canvas is faster than sprites/DOM manipulation
- png sprites are faster than svg sprites
- canvases are better managed with something like https://github.com/d3/d3
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question