Search the Community
Showing results for tags 'reverse mask'.
Found 1 result
PIXI 4.6+ way of cutting shapes using other shapes?
timetocode posted a topic in Pixi.jsI've been reading a backlog of how to do this all the way back to when the recommendation was to use canvas. What is the new and modern way of accomplishing this? Let's say I have a rectangle that fills my screen and makes the game look like night time.. then I have a torch and I want to cut (or lighten) a circle out of the night rectangle. I've tried drawing a circle using graphics and setting its colors to white, black, and alphas to 1.0 or 0, then adding it as a mask onto the rectangle -- this only seems to perform a regular mask operation (aka draw the night within the circle) but never the opposite (draw the nighttime everywhere but the circle). I know how to accomplish this via canvas or webgl, but it looks like this feature is already in pixi I'm just not sure how to do it! Thanks for reading! p.s. if the answer involves using a filter could you please reply with code.. im never sure which object exactly gets the filter added EDIT: and will the new method work if calculated *every frame* ?