Isaac Clark2017-04-05 13:43:42
Isaac Clark, 2017-04-05 13:43:42

HTML5 GAME: Is it better to use Canvas or DIV for sprite animation?

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

5 answer(s)
DevMan, 2018-03-10

it really doesn't exist, but there is php.net/manual/en/function.preg-match-all.php

Dmitry Belyaev, 2017-04-05

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

Konstantin Kitmanov, 2017-04-05

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 :)

alvvi, 2017-04-05

Canvas and EasleJS / Phaser to help you. Well, or build your own kind of engine if you like cycling.

Vlad Feninets, 2017-04-05

- 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 question

Ask a Question

731 491 924 answers to any question