Search the Community
Showing results for tags 'pixiv5'.
-
Hello! I'm quite new to pixi.js community. I’m trying to add SVG with foreignObject to Pixi and I guess I have some understanding issue, because my example works well with default 2d canvas but looks way blurry in Pixi’s WebGL. Any tips for this case? https://stackblitz.com/edit/pixijs-text-rendering?file=index.ts
-
Hi, I am trying to update the basetexture source with different images at different points in my game. In pixi 4 it was easy, we could use BaseTexture.updateSourceImageO , but in Pixi 5 we dont have this at all. Is there any straight forward way to do it in Pixi 5 ? I havent found any s far. Migration to pixi 5 is stalled due to this. Any help is much appreciated. regards, Arin
-
EDITED: This problem is solved. The solution is in this message. Hello, Require.js does not understand '.' (dot) in the module name: "pixi.js". Here in the RequireConfig.ts file: RequireConfig.ts requirejs.config({ baseUrl: "js", paths: { "pixi.js": "https://cdnjs.cloudflare.com/ajax/libs/pixi.js/5.0.4/pixi.min" } }); requirejs(["Program"], () => { }); I changed "pixi.js" to "pixijs" in this file: "node_modules\pixi.js\pixi.js.d.ts" here: declare module "pixijs" { export = PIXI; } But now PIXI is undefined in my example: import * as PIXI from "pixijs"; export class Game { public constructor() { const app = new PIXI.Application(); console.log(app); } }
-
I'm trying to work out how to log asset byte sizes after load. e.g. something like this: PIXI.Loader.shared.add("bg", "img/bg.png") .on("progress", loadProgressHandler); function loadProgressHandler(loader, resource) { console.log(resource.size); } This possible?
-
tutorial for using pixi.js to make jigsaw game with webpack. try it online : http://testactivity.goooku.com/ishop-demo/jigsaw/index.html source code : https://github.com/proudcat/pixi-jigsaw
-
Hi, I am using PixiJS version 5.2.0 with the compressed-textures plugin version 2.0.3: If two dds-images are placed directly next to each other in a container and the container is scaled, a thin strip appears between the two images: If the scale of the parent container is exactly 1, no stroke is visible. With PixiJS 4.8.8 and compressed-textures-plugin 1.1.8 it works correctly and no stroke is visible. When the PixiJS scale mode is set to nearest (PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST) no stroke is visible (but the images becomes a little bit blurry). I suspect this is related to the interpolation constraint of the scale mode LINEAR, but I'm not sure if this is a PixiJS problem or a compressed-textures-plugin problem ... This is the complete code: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>PixiJS v5 Compressed Textures Bleeding</title> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/pixi.js"></script> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/pixi-compressed-textures.min.js"></script> </head> <body> <script> //PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST const app = new PIXI.Application({ width: 1024, height: 512 }) document.body.appendChild(app.view) new PIXI.Loader() .add('photo1', './1.dds') .add('photo2', './2.dds') .load((loaderInstance, resources) => { const sprite1 = new PIXI.Sprite(resources.photo1.texture) const sprite2 = new PIXI.Sprite(resources.photo2.texture) sprite1.width = sprite1.height = sprite2.width = sprite2.height = 512 sprite2.x = 512 app.stage.addChild(sprite1, sprite2) app.stage.scale.set(.8, .8) }) </script> </body> </html> Has anyone a good idea? Siddi
- 8 replies
-
- pixiv5
- compressed-textures
-
(and 1 more)
Tagged with:
-
please i need help!! //Here is the gradient function function Gradient(x, y, w, h, startColor, endColor){ let p1 = x+100 let p2 = y+50 let p3 = x+w-100 let p4 = y+h-80 let cvs = document.createElement('canvas') cvs.width = window.innerWidth-20 cvs.width = window.innerHeight-20 let ctx = cvs.getContext('2d') let grd = ctx.createLinearGradient(p1, p2, p3, p4) grd.addColorStop(0, startColor) grd.addColorStop(1, endColor) ctx.fillStyle = grd ctx.fillRect(x, y, w, h) return new PIXI.Texture.from(cvs) } //This is the params let x = 240 let y = 100 let h = 200 let w = 200 let a = new PIXI.Graphics() .beginTextureFill(app.Gradient(x, y, w, h, '#ff0000', '#00ff00')) .drawRect(x, y, w, h) .endFill() app.stage.addChild(a) My output is this: a red rectangle???, why?... If i use this code in javascript without pixi.js
-
Is there a way for PixiJS (or any plugin/script) to return the color value of a sprite if given a point value to check? What I'd like to do is create a collision map, which would be a large sprite with nothing but black and white shapes. This sprite would be on it's own layer underneath a painted background image. a character sprite would move around on a layer above, and any time the edges of it collides with a black part of the collision map, it would hit a wall.
-
Hi I'm trying to add onscreen buttons to move my sprite around my website. https://alfielytorres.github.io/hackercastle/ right now my code is as follows //load keyboard class Keyboard { constructor() { this.pressed = {}; } watch(el) { el.addEventListener('keydown', (e) => { this.pressed[e.key] = true; }); el.addEventListener('keyup', (e) => { this.pressed[e.key] = false; }); } app.loader.load((loader, resources) => { // create a new keyboard instance let kb = new Keyboard(); kb.watch(app.view); ..... }); ... //Jumping if (characterPosition.vy < 0) { characterPosition.y += characterPosition.vy; } if (!kb.pressed.ArrowUp && touchingGround && characterPosition.jumped) { characterPosition.jumped = false; } if (kb.pressed.ArrowUp && touchingGround && !characterPosition.jumped) { characterPosition.vy = -19; characterPosition.jumped = true; } //Right if (kb.pressed.ArrowRight) { characterPosition.direction = 0; characterPosition.vx = Math.min(8, characterPosition.vx + 2); } if (characterPosition.vx > 0) { characterPosition.vx -= 1; } //Left if (kb.pressed.ArrowLeft) { characterPosition.direction = 1; characterPosition.vx = Math.max(-8, characterPosition.vx - 2); } if (characterPosition.vx < 0) { characterPosition.vx += 1; }
-
Using pixi.js v5, I'm trying to fill a polygon with about one hundred vertices using Graphics.drawPolygon(), but the polygon is drawn incorrectly. When I reduce the number of vertices to about 50, then the polygon is drawn correctly. Is there any limit (near 100) to the number of vertices that Graphics.drawPolygon() can draw? Thanks.
-
Hi. I'm not a html5 game developer but Front-end developer trying to draw a line chart with pixi.js. So, my question is not about the html5 game but just about how can I use pixi.js correctly. I was recommended this forum from pixi.js official site. Anyway, the problem is chrome browser stopped after about 2 minutes later ticker started. See this code (https://www.pixiplayground.com/#/edit/S~1QvhfSNDyACDvb0nkfc) It's a simple code for a line chart. 1. Add a basic PIXI container 2. Draw the first line with 4 dots. 3. Add next line every second using PIXI ticker and Change line x position. It works nicely at the moment But about 2 minutes later, the browser is crashed. I don't know why and how can I fix it. Help me!