Search the Community
Showing results for tags 'javascirpt'.
-
I am trying to load a sprite sheet for PIXI js. I have a png and json file in one folder, I am pretty sure there are fine on their own. But I can't get it to load. got this from http://pixijs.download/release/docs/PIXI.Spritesheet.html ... PIXI.Loader.shared.add("spritesheet.json").load(this.setup()); ... ... this.sheet = PIXI.Loader.shared.resources["spritesheet.json"].spritesheet; console.log(this.sheet) ... the log will say that the sheet is undefined. I think it either doesn't find the json or png file. Probably neither. I'm not sure what path "spritesheet.json" should be, relative to this file it woulde be "../assets/spritesheet.json". But that also fails. This is my webpack config: const path = require("path"); module.exports = { mode: "development", devtool: "eval-cheap-source-map", entry: "./app/index.js", output: { filename: "bundle.js", path: path.resolve(__dirname, "client"), }, module: { rules: [ { test: /\.(png|svg|jpg|jpeg|gif)$/i, loader: "file-loader", options: { name: '[name].[ext]', }, }, ], }, }; And this is how the bundle looks. spritesheet.png is loaded when I put it as an <img> in the html. So I know it is being received by the client. I also get this if I console.log(this.sheet) with this.sheet = PIXI.Loader.shared.resources["spritesheet.json"]; Looks like it can't find the json file either. So I guess my question is, what are the paths of the json and png file?
- 1 reply
-
- javascirpt
- webpack
-
(and 1 more)
Tagged with:
-
Hi Everyone, So I'm attempting to learn Javascript as well as can be expected, and I'm considering what are the absolute best assets where I could learn it? Books, sites whatever you folks figure its the most ideal approach to learn without anyone else please I am truly getting a charge out of learning and I might want to seek after this as a lifelong one day.