• Content Count

  • Joined

  • Last visited

  • Days Won

  1. Thanks for your advice, I've tried it as you said. It seems to work, but how do I remove the black area? I want it became transparent which is black now function setup(loader, res) { let cloth = new PIXI.Sprite(PIXI.loader.resources["cloth"].texture) let flower = new PIXI.TilingSprite(PIXI.loader.resources["flower"].texture); let fw = 328; let fh = 240; let cw = 179; let ch = 182; flower.anchor.set(0.5,0.5); flower.rotation = 0.3; flower.scale.set(1.1,1.1); flower.width = fw; flower.height = fh; flower.position.set(fw/2,fh/2); flower.tilePosition.set((fw-cw)/2,(fh-ch)/2); flower.blendMode= PIXI.BLEND_MODES["MULTIPLY"]; cloth.filters = [new PIXI.filters.AlphaFilter()]; cloth.addChild(flower); app.stage.addChild(cloth); }
  2. In addition, there may be multiple sprites on my stage. I only hope that the flower only works on the specified cloth sprite without affecting other sprites, so I may not be able to use PIXI.BLEND_MODES.
  3. I tried Tiling Sprite and MULTILIPLE, but this way can't meet my requirements. My cloth picture may have some transparency. I don't want the flower picture to cover the transparent area.
  4. I provided a demo on codepen,please visit this url: I expect to draw filters based on the center point when tile/rotate/scale/move, not the upper left corner now, please help me, thanks.
  5. I wrote a filter to achieve special effects. Part of the code is as follows,scale and rotate works well,but the anchor I set seems not right,the sprite still rotates around the upper left corner. constructor(texture:PIXI.Texture) { super(MyFilter.vertSrc, MyFilter.fragSrc) this.maskMatrix = new PIXI.Matrix(); let sprite = new PIXI.Sprite(texture); app.stage.addChild(sprite); sprite.visible = false; this.maskSprite = sprite; this.maskSprite.anchor.set(0.5) //it doesn't work! this._translate = [0, 0]; this.uniforms.mapSampler = sprite.texture; this.uniforms.filterMatrix = this.maskMatrix; } translate(x:number, y:number) { this._translate[0] = x; this._translate[1] = y; this.uniforms.vTranslate = this._translate; } scale(x:number, y:number) { this.maskSprite.scale.set(x, y); } rotate(rad:number) { this.maskSprite.rotation = rad; }
  6. I have some sprites, I want to overlay one of them with a picture, looks like multiply blendMode, but without affecting the other sprites. I tried use mask,but it makes the sprite transparent. Is there any way can do this?