You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/display/mask/BitmapMask.js
+20-5Lines changed: 20 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -8,15 +8,30 @@ var Class = require('../../utils/Class');
8
8
9
9
/**
10
10
* @classdesc
11
-
* A Bitmap Mask combines the alpha (opacity) of a masked pixel with the alpha of another pixel. Unlike the Geometry Mask, which is a clipping path, a Bitmask Mask behaves like an alpha mask, not a clipping path. It is only available when using the WebGL Renderer.
11
+
* A Bitmap Mask combines the alpha (opacity) of a masked pixel with the alpha of another pixel.
12
+
* Unlike the Geometry Mask, which is a clipping path, a Bitmap Mask behaves like an alpha mask,
13
+
* not a clipping path. It is only available when using the WebGL Renderer.
12
14
*
13
-
* A Bitmap Mask can use any Game Object to determine the alpha of each pixel of the masked Game Object(s). For any given point of a masked Game Object's texture, the pixel's alpha will be multiplied by the alpha of the pixel at the same position in the Bitmap Mask's Game Object. The color of the pixel from the Bitmap Mask doesn't matter.
15
+
* A Bitmap Mask can use any Game Object to determine the alpha of each pixel of the masked Game Object(s).
16
+
* For any given point of a masked Game Object's texture, the pixel's alpha will be multiplied by the alpha
17
+
* of the pixel at the same position in the Bitmap Mask's Game Object. The color of the pixel from the
18
+
* Bitmap Mask doesn't matter.
14
19
*
15
-
* For example, if a pure blue pixel with an alpha of 0.95 is masked with a pure red pixel with an alpha of 0.5, the resulting pixel will be pure blue with an alpha of 0.475. Naturally, this means that a pixel in the mask with an alpha of 0 will hide the corresponding pixel in all masked Game Objects. A pixel with an alpha of 1 in the masked Game Object will receive the same alpha as the corresponding pixel in the mask.
20
+
* For example, if a pure blue pixel with an alpha of 0.95 is masked with a pure red pixel with an
21
+
* alpha of 0.5, the resulting pixel will be pure blue with an alpha of 0.475. Naturally, this means
22
+
* that a pixel in the mask with an alpha of 0 will hide the corresponding pixel in all masked Game Objects
23
+
* A pixel with an alpha of 1 in the masked Game Object will receive the same alpha as the
24
+
* corresponding pixel in the mask.
16
25
*
17
-
* The Bitmap Mask's location matches the location of its Game Object, not the location of the masked objects. Moving or transforming the underlying Game Object will change the mask (and affect the visibility of any masked objects), whereas moving or transforming a masked object will not affect the mask.
26
+
* The Bitmap Mask's location matches the location of its Game Object, not the location of the
27
+
* masked objects. Moving or transforming the underlying Game Object will change the mask
28
+
* (and affect the visibility of any masked objects), whereas moving or transforming a masked object
29
+
* will not affect the mask.
18
30
*
19
-
* The Bitmap Mask will not render its Game Object by itself. If the Game Object is not in a Scene's display list, it will only be used for the mask and its full texture will not be directly visible. Adding the underlying Game Object to a Scene will not cause any problems - it will render as a normal Game Object and will also serve as a mask.
31
+
* The Bitmap Mask will not render its Game Object by itself. If the Game Object is not in a
32
+
* Scene's display list, it will only be used for the mask and its full texture will not be directly
33
+
* visible. Adding the underlying Game Object to a Scene will not cause any problems - it will
34
+
* render as a normal Game Object and will also serve as a mask.
Copy file name to clipboardExpand all lines: src/display/mask/GeometryMask.js
+16-5Lines changed: 16 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,21 @@ var Class = require('../../utils/Class');
8
8
9
9
/**
10
10
* @classdesc
11
-
* A Geometry Mask can be applied to a Game Object to hide any pixels of it which don't intersect a visible pixel from the geometry mask. The mask is essentially a clipping path which can only make a masked pixel fully visible or fully invisible without changing its alpha (opacity).
11
+
* A Geometry Mask can be applied to a Game Object to hide any pixels of it which don't intersect
12
+
* a visible pixel from the geometry mask. The mask is essentially a clipping path which can only
13
+
* make a masked pixel fully visible or fully invisible without changing its alpha (opacity).
12
14
*
13
-
* A Geometry Mask uses a Graphics Game Object to determine which pixels of the masked Game Object(s) should be clipped. For any given point of a masked Game Object's texture, the pixel will only be displayed if the Graphics Game Object of the Geometry Mask has a visible pixel at the same position. The color and alpha of the pixel from the Geometry Mask do not matter.
15
+
* A Geometry Mask uses a Graphics Game Object to determine which pixels of the masked Game Object(s)
16
+
* should be clipped. For any given point of a masked Game Object's texture, the pixel will only be displayed
17
+
* if the Graphics Game Object of the Geometry Mask has a visible pixel at the same position. The color and
18
+
* alpha of the pixel from the Geometry Mask do not matter.
14
19
*
15
-
* The Geometry Mask's location matches the location of its Graphics object, not the location of the masked objects. Moving or transforming the underlying Graphics object will change the mask (and affect the visibility of any masked objects), whereas moving or transforming a masked object will not affect the mask. You can think of the Geometry Mask (or rather, of the its Graphics object) as an invisible curtain placed in front of all masked objects which has its own visual properties and, naturally, respects the camera's visual properties, but isn't affected by and doesn't follow the masked objects by itself.
20
+
* The Geometry Mask's location matches the location of its Graphics object, not the location of the masked objects.
21
+
* Moving or transforming the underlying Graphics object will change the mask (and affect the visibility
22
+
* 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
24
+
* in front of all masked objects which has its own visual properties and, naturally, respects the camera's
25
+
* visual properties, but isn't affected by and doesn't follow the masked objects by itself.
16
26
*
17
27
* @class GeometryMask
18
28
* @memberof Phaser.Display.Masks
@@ -38,7 +48,7 @@ var GeometryMask = new Class({
38
48
this.geometryMask=graphicsGeometry;
39
49
40
50
/**
41
-
* Similiar to the BitmapMasks invertAlpha setting this to true will then hide all pixels
51
+
* Similar to the BitmapMasks invertAlpha setting this to true will then hide all pixels
0 commit comments