Hi,
I have a huge problem with PIXI.loader. The thing is, I am trying to create an animated sprite, however no loading method I do does any good. The images aren't corrupted and can be opened without any troubles, so the problem is not there...
However, when I try to load the pictures through PIXI.loader, the texture should be created automatically... But it isn't and PIXI.loader.resources [resourcepath].texture throws me undefined (also, if I show the resources in console, it will tell me that isImage = false). If I use PIXI.Texture.fromImage, it returns its' dimensions as 1x1.
The only way I can manage to create some textures is to combine both. So use PIXI.loader, then use PIXI.Texture.fromImage. This throws me double entry warnings (because the resource has already been loaded), creates a 1x1 texture in textureCache, but at least I finally have a valid texture in PIXI.loader. Or an easy fix is to hit Back and Forward in my browser, that will display the animation sprite with no problem.
However, that is both annoying and impractical. I'm fighting with this for two days and still cannot figure out how to tame the pixi textures! ![:( :(]()
var renderer = new PIXI.CanvasRenderer (window.innerWidth-40, 800);
renderer.autoResize = true
var keyboard;
var stage = new PIXI.Container ();
PIXI.loader
.add (['img/angel1.png', 'img/angel2.png', 'img/angel3.png', 'img/angel4.png', 'img/angel5.png', 'img/angel6.png', 'img/angel7.png', 'img/angel8.png'])
.load (onAssetsLoaded())
function onAssetsLoaded () {
var frames = []
for (var i = 1; i<9; i++) {
frames.push (PIXI.Texture.fromImage("img/angel" + i + ".png"))
}
}
So far this is the only code with which I have succeeded to have some usable texture. If I use only Texture.fromImage, I will get textures 1x1, and if I use only loader, it will not make textures and won't recognize these png as images.
I use PIXI version 4.5.6 btw. And canvas or webGL renderer is not relevant, the problem is the same.
Thank you very much.