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

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

5 answer(s)
D
DevMan, 2018-03-10
@kot-airplane

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

D
Dmitry Belyaev, 2017-04-05
@Dark_Knight

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

K
Konstantin Kitmanov, 2017-04-05
@k12th

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

A
alvvi, 2017-04-05
@alvvi

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

V
Vlad Feninets, 2017-04-05
@fnnzzz

- 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