Use hardware acceloration? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Use hardware acceloration?

How to force the browser to use hardware acceleration for 2d & other animation in CSS?

14th Mar 2017, 7:56 AM
Rateb Özil
Rateb Özil - avatar
4 Answers
+ 1
use css compressor?
15th Mar 2017, 5:44 PM
Jakub Konkel
Jakub Konkel - avatar
+ 1
@jakub konkel: no i mean using GPU for 2d animation & transitions instead of CPU
15th Mar 2017, 7:37 PM
Rateb Özil
Rateb Özil - avatar
+ 1
Since the redrawing of elements is a heavier and more expensive opration. browsers use from a layer model for drawing elements. when an opration transfer to the GPU browser make a separate layer for the opration and its element an it cause to run the opration faster and smoothly also prevent from redrawing of mentioned element and other elements. All animations & transitions automatically don't move to the GPU but some animations like opacity, transform (3D transforms with animation) & filter also video and canvas will transfer to GPU automatically. But what we can do for 2D transforms & other animations? We must confuse browser to think the element has 3D draws so browser will move it to the GPU and run it. But how can we do? look at this code: #element { transform: translate3d(0,0,0) /*other transforms*/ } when browser encounters with this code quickly it will move the element to the GPU for smoothly runing but in principle there is no 3D oprations.
18th Mar 2017, 8:12 PM
Rateb Özil
Rateb Özil - avatar
0
@jakub konkel: I mean hardware acceleration for animated elements (use GPU beside CPU)
12th Apr 2017, 8:51 PM
Rateb Özil
Rateb Özil - avatar