Reputation: 20484
I have noticed jerky laggy performance when I change an elements width or margin with CSS transitions.
Is there anyway to force hardware acceleration? Is there any way to use transform properties to achieve a seamingly similar result?
Upvotes: 5
Views: 4565
Reputation: 18026
Not really. Hardware acceleration depends on a lot of factors, none of them under javascript control.
Which leaves us the question of how to improve CSS width/margin transition performance, and the answer is usually "replace it with scale", because it can be done cheaply on GPU and because it doesn't trigger reflow.
It is also known that Chrome does not do as well a job accelerating CSS transitions as Firefox and IE.
In fact, given that Google rejected Pointer Event on the ground of speed, which IE solved by GPU acceleration, it can be said that Chrome (and Webkit in general - Safari is even slower) is lagging behind on this front, and the only way to help is contributing code to Chromium / Webkit.
I'd rather switch to a quicker transition.
Upvotes: 5