Jump to content

Base64 Images


Recommended Posts

Since you are adding this to `this.textures`, and not loading it using the regular `this.load`, Rich mentioned you need to do a little extra work to make this work. He commented on that GitHub issue - https://github.com/photonstorm/phaser/issues/3342#issuecomment-372332727

Note that you must listen out for the onload event from the Texture Manager before you can use the base64 texture in a game object.

So once you do the add the base 64 data to the textures object, you'll also need to do something like:

this.textures.on('onload', function() { /* do something with the texture */ });


Link to comment
Share on other sites

  • 2 weeks later...

May be someone know is it possible to use preloaded images as spritesheet? Or may be here is some another way to preload spritesheet as base64?

UPD found how to add frames for already preloaded images in base64 (further it can be used as spritesheet)

this.textures.list.NAMEOFIMAGE.add(index, 0, startX, startY, width, height);

index - number of frame

startX and startY - coordinates for upper left corner cropping rectangle

width and height - size of cropping rectangle

You can easily wrap it into cycle and crop  your spritesheet to frames.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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