Jump to content

Base64 Spritesheet ?


legendaryious
 Share

Recommended Posts

Hello ! I want to integrate have my spritesheet based on a Base64 Image. I am not 100% sure how to make it work. I cant make it work. I dont get textures in my spritesheet in the end...
 

  sheet = new PIXI.Spritesheet(PIXI.Texture.from("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA...."), {
            "frames": {
                "banana.png": {
                    "frame": {"x":513, "y":0, "w":512, "h":512},
                    "spriteSourceSize": {"x":0,"y":0,"w":512,"h":512},
                    "sourceSize": {"w":512,"h":512}
                },
                "coin.png": {
                    "frame": {"x":513, "y":513, "w":310, "h":334},
                    "spriteSourceSize": {"x":0,"y":0,"w":310,"h":334},
                    "sourceSize": {"w":310,"h":334}
                },
                "strawberry.png": {
                    "frame": {"x":0, "y":0, "w":512, "h":512},
                    "spriteSourceSize": {"x":0,"y":0,"w":512,"h":512},
                    "sourceSize": {"w":512,"h":512}
                },
                "wrong.png": {
                    "frame": {"x":0, "y":513, "w":512, "h":512},
                    "spriteSourceSize": {"x":0,"y":0,"w":512,"h":512},
                    "sourceSize": {"w":512,"h":512}
                }

            },
            "meta": {
                "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA....",
                "size": {"w": 1026, "h": 1026},
                "scale": "1"
            }
        });

 

Link to comment
Share on other sites

Out docs dont have this entry, but: when you use spritesheet manually, you have to call "parse" method: https://github.com/pixijs/pixi.js/blob/1d09bfca1ae1a2fcdcca4c8a80ed59f605abcd76/packages/spritesheet/src/Spritesheet.ts#L167

Because, someone thought that parsing is too slow there and has to be async. It wont be async if its less than 1000 textures though

Edited by ivan.popelyshev
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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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