Jerky CSS transform transition in Chrome

后端 未结 3 1546
攒了一身酷
攒了一身酷 2020-12-14 07:33

I am using CSS3 transform on a background image to enlarge on hover.

I have tested in the latest browsers of Opera, Safari and Firefox and work nice and smooth, how

3条回答
  •  执念已碎
    2020-12-14 07:44

    Fundamental issue

    When an animation runs slowly and looks uneven, it's simply exposing the limitations of the browser that are always there.

    Browsers don't have a dedicated thread for rendering animations. Animations have to compete with other browser activities like UI events. And at times the browser is also competing with other software running on the computer. Plus the hardware acceleration available to browsers is likely somewhat limited.

    Animations with easing run even slower at the start and/or end of the animation, which makes the natural unevenness of animations even more obvious.

    Solutions

    The simplest solution to prevent the unevenness from being so obvious is to increase the speed of the animation, and optionally remove or lessen the use of easing. It may be possible to use a type of easing that doesn't slow down quite as much at the beginning and end.

    Going forward, another option is to use the hardware acceleration of WebGL (HTML5 canvas tag with a 3D context), which should lessen the issue. As hardware acceleration becomes more common and better-supported on browsers and devices, it should start to be feasible to make complex animations that run as smoothly as older Flash animations.

提交回复
热议问题