Jump to content

how to choose how many image sequences in a spritesheet for animating a sprite?


tasumta
 Share

Recommended Posts

here's the example from the documentain 

 

PIXI.Loader.shared.add("assets/spritesheet.json").load(setup);

function setup() {
  let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet;
  animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]);
  ...
}

 

but I have a lot of image sequences some for walking some for jumping, but if I follow this example all the animations will be shown at once, so how to choose how many images?

 

THANKS

Link to comment
Share on other sites

Hello and welcome to the forums!

Animations are just array of `PIXI.Texture` ' s, you can make your own easily from `textures` in spritesheet itself. If you need to adjust speed, remove some frames, add timers to frames - you have to look in AnimatedSprite source. AnimatedSprite is baseline class for animations, it can work in production only in basic cases. Usually people override its methods to make more features. Documentation is fine but , its not enough, and , AnimatedSprite itself is not rocket science - you can just look in the sources!

As for how to solve your particular issue - my experience is not enough to understand what are you asking for. You can wait for someone else, or you can try to describe it better, make a demo, or you can just read the sources. https://github.com/pixijs/pixi.js/blob/dev/packages/sprite-animated/src/AnimatedSprite.ts

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