3

Pixi.js has a document that lists a number of performance tips. They are all great bits of advice, but I have trouble understanding and using one of them.

Axis-aligned Rectangle Masks are the fastest (as they use scissor rect)

I know what "axis-aligned rectangles" are, I just do not understand how to use them in Pixi.js.

I was thinking that I should use a PIXI.Rectangle, but a mask of DisplayObject is defined to be a PIXI.Graphics | PIXI.Sprite.

Is there a hidden trick to this, or is this a regular PIXI.Graphics mask with a non-rotated rectangle drawn onto it?

gman
  • 100,619
  • 31
  • 269
  • 393
Patryk Ziemkowski
  • 1,490
  • 12
  • 26

1 Answers1

2

I've received a response from an author of Pixi.js through Gitter.

"Axis-aligned rectangles" are created exactly by calling drawRect on Pixi.Graphics element.

Patryk Ziemkowski
  • 1,490
  • 12
  • 26