forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlpha.js
More file actions
44 lines (31 loc) · 677 Bytes
/
Copy pathAlpha.js
File metadata and controls
44 lines (31 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var Clamp = require('../../math/Clamp');
// Alpha Component
// bitmask flag for GameObject.renderMask
var _FLAG = 2; // 0010
var Alpha = {
_alpha: 1,
alpha: {
get: function ()
{
return this._alpha;
},
set: function (value)
{
this._alpha = Clamp(value, 0, 1);
if (this._alpha === 0)
{
this.renderFlags &= ~_FLAG;
}
else
{
this.renderFlags |= _FLAG;
}
}
},
setAlpha: function (value)
{
this.alpha = value;
return this;
}
};
module.exports = Alpha;