-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for animated sprite sheets #46
Comments
hello, do you have any plan to support this? thanks |
A quick helper utility – to load any spritesheet as an function makeAnimation(sheetName: string, filter?: string): AnimatedSprite {
const sheet: Spritesheet = Assets.get(sheetName);
const frames = (filter
? Object.keys(sheet.textures).filter(key => key.includes(filter))
: Object.keys(sheet.textures))
.sort().map(key => sheet.textures[key]!);
return new AnimatedSprite(frames);
} Tip Supports any spritesheet where input image names are orderable.
or many animations in a generic spritesheet:
Just make sure you don't run into the classic e.g. // Load a standalone animation
const myAnimation = makeAnimation("assets/[email protected]");
myAnimation.play();
// Load animation from any sheet
const appleAnimation = makeAnimation("assets/[email protected]", "apple");
const bananaAnimation = makeAnimation("assets/[email protected]", "banana"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently when generating sprite sheets, there is no way to mark it as an animated sprite sheet.
This would allow for use in Pixi's
AnimatedSprite
, as the generated JSON would contain theanimations
property (listing the textures used as part of the animated sprite).The text was updated successfully, but these errors were encountered: