1

In order to do a Movie Clip in PIXI.js are you required to have a JSON file? Is it possible to have the JSON inside the same file, especially if the movie clip is only a few frames and load the image like you load all other Sprites.

The only examples they have of movie clips is a bloated Fighter Jet example. Is this method possible? As MovieClip extends Sprite. I hoped to achieve this because I have multiple images with the exact same frame information and I did not wish to duplicate it all.

$(document).ready(function() {
    PIXI.loader
        .add('point', rootUrl + "images/games/faction/base_point_sprite.png")
        .load(start);
});

functions start() {

}
Case
  • 4,244
  • 5
  • 35
  • 53

1 Answers1

0

are you required to have a JSON file?

No. A MovieClip only requires an Array of textures. Those textures could come from JSON file, or from separate images.

Is it possible to have the JSON inside the same file?

Not sure what you mean, but typically when loading in a Sprite sheet, you would have a png image plus a JSON file that corresponds with it.

Here is a MovieClip example that uses 4 separate images instead of a JSON file:

var imgs = ["image01.png","image02.png","image03.png","image04.png"];
var textures = [];

for (var i=0; i < 4; i++)
{
     textures.push(PIXI.Texture.fromImage(imgs[i]));
};

var mc = new PIXI.MovieClip(textures);
Karmacon
  • 3,128
  • 1
  • 18
  • 20