Masking is it possible and how's it done?

Hello all I was doing a little coding a while back and noticed that I could really create some cool stuff if only I knew how to create and call alpha masking images in a scene using js. I know pixi allows it but i don't know how to use it. So if there is anyone that knows how to accomplish this a few pointers or any info would be much appreciated thanks.
+1
I will also be interested. For my Pixitext plugin
you just pass the sprite you want to use as a mask to the sprite you want to apply the mask to, something like:
Code:
sprite.mask = maskSprite;

Here's a quick pixi example:
http://codepen.io/Quxios/pen/LWpvyr/
you just pass the sprite you want to use as a mask to the sprite you want to apply the mask to, something like:
Code:
sprite.mask = maskSprite;

Here's a quick pixi example:
http://codepen.io/Quxios/pen/LWpvyr/
thanks i lot for this example
Wow thanks!
you just pass the sprite you want to use as a mask to the sprite you want to apply the mask to, something like:
Code:
sprite.mask = maskSprite;

Here's a quick pixi example:
http://codepen.io/Quxios/pen/LWpvyr/
Wow thanks a lot for this, I can't wait to try it out!
================================

Doesn't work with rmmv. Well i can't get it to work. you can't use custom sprites for masking.
solved with sprite mask from pixi.
add this prototype in a blank file
PHP:
//□▼↓▼□═══════════════════════════════════════════════════□□═══════════════════════════════════════════════════□↓↓↓
Game_Picture.prototype.addMask = function(maskID){
        this._maskParent = maskID; // info only about the parent mask
        var theMask = SceneManager._scene._spriteset._pictureContainer.children[maskID-1];
        var masked = SceneManager._scene._spriteset._pictureContainer.children[this._PID-1];
        masked.mask = theMask;
        return this
    };
//□▲↑▲□═══════════════════════════════════════════════════□□═══════════════════════════════════════════════════□↑↑↑

and call a picture like thats

PHP:
            $gameScreen.showPicture(5, name,0,  x,y,...); //ex: black Mask Form or radien or ..
            $gameScreen.showPicture(6, name,0,  x,y,...).addMask(5); // now picture 6 only show in the pic5 mask
@Jonforum
not work for me.. *(RPG MV 1.6.1) test in new project with no other plugins except your prototype code

JavaScript:
$gameScreen.showPicture(1, "Black", 0, 0, 0, 100,100,255,0);
$gameScreen.showPicture(2, "Chimera", 0, 0, 0, 100,100,255,0).addMask(1);


mask error.png
Got it!!! this article help some.

anyway this is my answer:
JavaScript:
this.Mymask = new PIXI.Graphics();//this acts as a mask for
     this.Mymask = new Sprite(ImageManager.loadTitle1("Jungle"));
    this.addChildAt(this.Mymask,1);

  this._shade = new Sprite(ImageManager.loadTitle1("Gold")); // this <=========== so this should be your image and the first one is your mask
    this._shade.x = Graphics.width/2;
    this._shade.y = Graphics.height/2;
    this._shade.anchor.x = 0.5;
    this._shade.anchor.y = 0.5;
    this.addChildAt(this._shade,4);  
    this._shade.mask = this.Mymask;
rmmz only and i think

Pm me for details~

Original thread: https://forums.rpgmakerweb.com/threads/masking-is-it-possible-and-hows-it-done.75417/