Jump to content

Cropping a portion of the screen (masks?)


pistacchio
 Share

Recommended Posts

Hi,

how can i define a region of the screen and crop some game elements that are inside of it so? Look at the following example:

 

dbqjwHz.gif

In you can see how i have some green elements, and some red sprites and yellow particles within the pink region. I'd like to leave the green sprites untouched, but specify that red and yellow sprites belong to the pink region and so, if some parts of them is outside the region, just don't show them.

Link to comment
Share on other sites

Hi, look at this article: http://www.goodboydigital.com/pixi-js-brings-canvas-and-webgl-masking/

 

Unfortunately this works only for simple mask shapes - if you want something complex like "fence" view then you probably cannot (in WebGL it would be possible if you employed stencil buffer somehow, but I have no idea, how to make it for both Canvas+WebGL)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...