autemox Posted September 8, 2018 Share Posted September 8, 2018 UPDATE: i used Rectangle instead of PIXI.Rectangle. Problem solved. Hello. I am following along with a tutorial https://github.com/kittykatattack/learningPixi I was able to run Pixi successfully in an Angular 6 app using steps I describe here:https://old.reddit.com/r/pixijs/comments/9dzdme/how_to_use_pixi_js_with_angular_6/ I was able to sucessfully load sprites without spritesheets using this code: https://www.paste.org/95084 When attempting to load sprites with spritesheets using this code ngOnInit() { this.app = new PIXI.Application({ // this creates our pixi application width: 800, height: 600, backgroundColor: 0x1099bb }); this.pixiContainer.nativeElement.appendChild(this.app.view); PIXI.loader .add([ 'assets/images/chicken.png', // load sprite textures 'assets/images/chicken-spritesheet.png' ]) .on("progress", this.loadProgressHandler) .load(this.setup.bind(this)); } loadProgressHandler(loader, resource) { console.log(`loaded ${resource.url}. Loading is ${loader.progress}% complete.`); } setup() { // runs when textures are done loading console.log(`loading complete.`); // prepare the spritesheet let texture = PIXI.utils.TextureCache["assets/images/chicken-spritesheet.png"]; //Create the `tileset` sprite from the texture let rectangle:Rectangle = new Rectangle(0, 0, 16, 16); //Create a rectangle object that defines the position and size of the sub-image you want to extract from the texture texture.frame = rectangle; //Tell the texture to use that rectangular section //Create the sprite from the texture let bunny = new Sprite(texture); } I encounter an error: ERROR in ./node_modules/pixi.js/lib/core/renderers/webgl/filters/spriteMask/SpriteMaskFilter.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\core\renderers\webgl\filters\spriteMask' ERROR in ./node_modules/pixi.js/lib/core/sprites/webgl/generateMultiTextureShader.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\core\sprites\webgl' ERROR in ./node_modules/pixi.js/lib/extras/webgl/TilingSpriteRenderer.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\extras\webgl' ERROR in ./node_modules/pixi.js/lib/filters/alpha/AlphaFilter.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\filters\alpha' ERROR in ./node_modules/pixi.js/lib/filters/colormatrix/ColorMatrixFilter.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\filters\colormatrix' ERROR in ./node_modules/pixi.js/lib/filters/displacement/DisplacementFilter.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\filters\displacement' ERROR in ./node_modules/pixi.js/lib/filters/fxaa/FXAAFilter.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\filters\fxaa' ERROR in ./node_modules/pixi.js/lib/filters/noise/NoiseFilter.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\filters\noise' ERROR in ./node_modules/pixi.js/lib/loaders/bitmapFontParser.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\loaders' ERROR in ./node_modules/pixi.js/lib/mesh/webgl/MeshRenderer.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\mesh\webgl' i 「wdm」: Failed to compile. Here is the full code: https://github.com/autemox/first-pixi-angular-6-app/blob/master/src/app/app.component.ts Does anyone have any guidance for me? I'm not sure what is wrong. Thank you. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.