HTML5 Canvas Performance: Loading Images vs Drawing

后端 未结 7 598
渐次进展
渐次进展 2021-02-04 08:23

I\'m planning on writing a game using javascript / canvas and I just had 1 question: What kind of performance considerations should I think about in regards to loading images vs

7条回答
  •  天涯浪人
    2021-02-04 08:49

    It really depends on the type of graphics you'll use, so I suggest you implement the easiest solution and solve the performance problems as they appear.

    Generally I would expect copying a bitmap (drawing an image) to get faster compared to recreating it from primitives, as the complexity of the image gets higher.

    That is drawing a couple of squares per scene should need about the same time using either method, but a complex image will be faster to copy from a bitmap.

提交回复
热议问题