Jump to content

TexturePacker Animations Problem


Jonny Shaw
 Share

Recommended Posts

Hi all, been trying to use the .animations feature of texturepacker for a small animated icon, but for some reason It's not finding the animations object even though it's detected and visible in the generated json file?
https://www.codeandweb.com/texturepacker/tutorials/how-to-create-sprite-sheets-and-animations-with-pixijs

Any clues on something probably obvious that I'm missing here, or has something changed?

Error I get is Cannot read property 'electron' of undefined.  Have also tried adding both .spritesheet and .textures to the sheet declaration.

If I use .textures in the sheet declaration and use a single sprite it is fine, so it's definately loading the json file correctly

 

class ScoreIcon extends PIXI.Container{
    constructor(){
        super(...arguments);
        let sheet = PIXI.loader.resources["./assets/electronAtlas.json"];
        
        this.sprite = new PIXI.extras.AnimatedSprite(sheet.animations["electron"]);
        this.addChild(this.sprite);
    }
}
export default ScoreIcon;

 

Annotation 2019-01-02 123613.jpg

Link to comment
Share on other sites

6 minutes ago, ivan.popelyshev said:

Which version of pixi do you use? You have enough experience to open debugger and look inside spritesheet loader to ensure that json animations were parsed correctly.

Currently on 4.8.1 but just updating that now.  No errors in loading it in the debugger that I can see (if I'm looking in the right place here)

Annotation 2019-01-02 125030.jpg

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