Moving mask along with arcade sprite

As mentioned in the topic I want mask to move along with the sprite. I do know that the Masks are positioned in global space and are not relative to the Game Object to which they are applied but is it possible to do the above?
Below is the code :

    let sprite = this.physics.add.sprite(0, 0, 'spritesheetName', 'kay');
    var pos = { x1: sprite.getLeftCenter().x, y1: sprite.getLeftCenter().y, x2: sprite.getCenter().x, y2: sprite.getCenter().y };
    var size = { w: sprite.displayWidth, h: sprite.displayHeight };
    const shape =;
    shape.lineStyle(size.w, 0x000000, 1);
    shape.lineBetween(pos.x1, pos.y1, pos.x2, pos.y2);
    const mask = shape.createGeometryMask();

Thank you.

Clear and redraw on shape.

I need to do that continuously in update() right?
Isn’t there any other way of doing it?
I just want to hide half of the image and move it.

You can set a crop rectangle instead of using a mask.