Jump to content

HTML5 canvas clone sprites


Recommended Posts

I have an army game made with HTML5 canvas.

I am using spritesheets (.png images) for sprites. And for every movement of every unit i redraw every unit like here:


ctx.drawImage( spritesheet, sprite_x, sprite_y, 44, 44, map_x, map_y, 44, 44 );

But i heard something about HTML5 canvas sprites copy for better performance.. But i can't google it out, or any examples of it. I heard that Pixi.js is using it, but i am not considering using Pixi.js. 

Do you know any examples or possibilities of cloning the same sprites for performance improvement?

Screenshot from 2017-07-10 18-02-07.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...