Performance of moving image on web page via CSS vs HTML5 Canvas

前端 未结 5 1033
北恋
北恋 2020-12-02 09:29

I have an image and move it around my web page (JavaScript) like this:

satelliteImage.style.top = coordinates.top + \"px\";
satelliteImage.style.left = coord         


        
5条回答
  •  余生分开走
    2020-12-02 10:02

    Figured I'd update this old question with my findings on a 3rd generation iPad:

    Canvas wins 2:1 with the sprite animations an average of about 120 fps with background clearing toggled both ways. CSS could barely meet 60 fps.

    As for the single image, CSS was definitely quicker.

提交回复
热议问题