B
B
bpGusar2019-01-10 11:49:05
css
bpGusar, 2019-01-10 11:49:05

Why is it that if you move an element in the Canvas, it moves at conditional 60fps, but if it is inside a DIV, then there are brakes?

Why is it that if you move an element in the Canvas, it moves at conditional 60fps, but if it is inside a DIV, then there are brakes?
It slows down performance, and it's not clear why, even if you place the DIV on the canvas, and moving the DIV to move the element on the canvas, the canvas element moves quickly and smoothly, and the DIV is very slow and slow.
Are there ways to cure this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dima Pautov, 2019-01-10
@bootd

Canvas and html tags are completely different things in terms of logic and structure. Html tags never implied dynamic movement, change, and the creation of DOM elements did not seem to be something necessary before. This has now changed, but echoes of this live on now due to backward compatibility. These are bricks that just have to stand.
The simplest and most performant option for tags is CSS transforms. You won't do anything else. Or, draw everything on canvas

G
GreatRash, 2019-01-10
@GreatRash

And how do you move cho-there-you-within div?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question