Jump to content

Load SVG containing multiple images


brentstrandy
 Share

Recommended Posts

  • 3 weeks later...

ANSWER: Load the SVG as a spritesheet

this.load.spritesheet(
      'avatar',
      'images/avatar_animations.svg',
      { frameWidth: 89, frameHeight: 184, endFrame: 10 }
);

And later in code you can do this:

let avatarImage = this.add.sprite(200, 200, 'avatar');

// Assuming you've added a jump animation....
avatarImage.anims.play('jump');

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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