Skip to content

Commit 1f0a516

Browse files
committed
GeometryMask.setInvertAlpha is a new method that allows you to set the invertAlpha property in a chainable call.
1 parent 12b6041 commit 1f0a516

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ Notes:
131131
* The `Key` method signature has changed. It now expects to receive a reference to the KeyboardPlugin instance that is creating the Key as the first argument. This is now stored in the new `Key.plugin` property, and cleared in `destroy`.
132132
* `KeyboardPlugin.removeKey` has a new optional argument `destroy` that will, if set, destroy the Key object being removed from the plugin.
133133
* `InteractiveObject.customHitArea` is a new property that records if the hitArea for the Interactive Object was created based on texture size (false), or a custom shape (true)
134+
* `GeometryMask.setInvertAlpha` is a new method that allows you to set the `invertAlpha` property in a chainable call.
134135

135136
### Bug Fixes
136137

src/display/mask/GeometryMask.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var Class = require('../../utils/Class');
2020
* The Geometry Mask's location matches the location of its Graphics object, not the location of the masked objects.
2121
* Moving or transforming the underlying Graphics object will change the mask (and affect the visibility
2222
* of any masked objects), whereas moving or transforming a masked object will not affect the mask.
23-
* You can think of the Geometry Mask (or rather, of the its Graphics object) as an invisible curtain placed
23+
* You can think of the Geometry Mask (or rather, of its Graphics object) as an invisible curtain placed
2424
* in front of all masked objects which has its own visual properties and, naturally, respects the camera's
2525
* visual properties, but isn't affected by and doesn't follow the masked objects by itself.
2626
*
@@ -65,10 +65,34 @@ var GeometryMask = new Class({
6565
* @since 3.0.0
6666
*
6767
* @param {Phaser.GameObjects.Graphics} graphicsGeometry - The Graphics object which will be used for the Geometry Mask.
68+
*
69+
* @return {this} This Geometry Mask
6870
*/
6971
setShape: function (graphicsGeometry)
7072
{
7173
this.geometryMask = graphicsGeometry;
74+
75+
return this;
76+
},
77+
78+
/**
79+
* Sets the `invertAlpha` property of this Geometry Mask.
80+
* Inverting the alpha essentially flips the way the mask works.
81+
*
82+
* @method Phaser.Display.Masks.GeometryMask#setInvertAlpha
83+
* @since 3.17.0
84+
*
85+
* @param {boolean} [value=true] - Invert the alpha of this mask?
86+
*
87+
* @return {this} This Geometry Mask
88+
*/
89+
setInvertAlpha: function (value)
90+
{
91+
if (value === undefined) { value = true; }
92+
93+
this.invertAlpha = value;
94+
95+
return this;
7296
},
7397

7498
/**

0 commit comments

Comments
 (0)