Skip to content

Commit 07e9878

Browse files
committed
Documented the Light game object.
1 parent 0255498 commit 07e9878

1 file changed

Lines changed: 28 additions & 23 deletions

File tree

src/gameobjects/lights/Light.js

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ var Utils = require('../../renderer/webgl/Utils');
99

1010
/**
1111
* @classdesc
12-
* [description]
12+
* A 2D point light.
13+
*
14+
* Add these to a scene using the ForwardDiffuseLightPipeline for lighting effects, or just to represent a point light.
1315
*
1416
* @class Light
1517
* @memberOf Phaser.GameObjects
@@ -19,9 +21,9 @@ var Utils = require('../../renderer/webgl/Utils');
1921
* @param {number} x - The horizontal position of the light.
2022
* @param {number} y - The vertical position of the light.
2123
* @param {number} radius - The radius of the light.
22-
* @param {number} r - The red color. A value between 0 and 1.
23-
* @param {number} g - The green color. A value between 0 and 1.
24-
* @param {number} b - The blue color. A value between 0 and 1.
24+
* @param {number} r - The red color of the light. A value between 0 and 1.
25+
* @param {number} g - The green color of the light. A value between 0 and 1.
26+
* @param {number} b - The blue color of the light. A value between 0 and 1.
2527
* @param {number} intensity - The intensity of the light.
2628
*/
2729
var Light = new Class({
@@ -31,7 +33,7 @@ var Light = new Class({
3133
function Light (x, y, radius, r, g, b, intensity)
3234
{
3335
/**
34-
* [description]
36+
* The horizontal position of the light.
3537
*
3638
* @name Phaser.GameObjects.Light#x
3739
* @type {number}
@@ -40,7 +42,7 @@ var Light = new Class({
4042
this.x = x;
4143

4244
/**
43-
* [description]
45+
* The vertical position of the light.
4446
*
4547
* @name Phaser.GameObjects.Light#y
4648
* @type {number}
@@ -49,7 +51,7 @@ var Light = new Class({
4951
this.y = y;
5052

5153
/**
52-
* [description]
54+
* The radius of the light.
5355
*
5456
* @name Phaser.GameObjects.Light#radius
5557
* @type {number}
@@ -58,7 +60,7 @@ var Light = new Class({
5860
this.radius = radius;
5961

6062
/**
61-
* [description]
63+
* The red color of the light. A value between 0 and 1.
6264
*
6365
* @name Phaser.GameObjects.Light#r
6466
* @type {number}
@@ -67,7 +69,7 @@ var Light = new Class({
6769
this.r = r;
6870

6971
/**
70-
* [description]
72+
* The green color of the light. A value between 0 and 1.
7173
*
7274
* @name Phaser.GameObjects.Light#g
7375
* @type {number}
@@ -76,7 +78,7 @@ var Light = new Class({
7678
this.g = g;
7779

7880
/**
79-
* [description]
81+
* The blue color of the light. A value between 0 and 1.
8082
*
8183
* @name Phaser.GameObjects.Light#b
8284
* @type {number}
@@ -85,7 +87,7 @@ var Light = new Class({
8587
this.b = b;
8688

8789
/**
88-
* [description]
90+
* The intensity of the light.
8991
*
9092
* @name Phaser.GameObjects.Light#intensity
9193
* @type {number}
@@ -94,7 +96,7 @@ var Light = new Class({
9496
this.intensity = intensity;
9597

9698
/**
97-
* [description]
99+
* The horizontal scroll factor of the light.
98100
*
99101
* @name Phaser.GameObjects.Light#scrollFactorX
100102
* @type {number}
@@ -103,7 +105,7 @@ var Light = new Class({
103105
this.scrollFactorX = 1.0;
104106

105107
/**
106-
* [description]
108+
* The vertical scroll factor of the light.
107109
*
108110
* @name Phaser.GameObjects.Light#scrollFactorY
109111
* @type {number}
@@ -113,7 +115,10 @@ var Light = new Class({
113115
},
114116

115117
/**
116-
* [description]
118+
* Set the properties of the light.
119+
*
120+
* Sets both horizontal and vertical scroll factor to 1. Use {@link Phaser.GameObjects.Light#setScrollFactor} to set
121+
* the scroll factor.
117122
*
118123
* @method Phaser.GameObjects.Light#set
119124
* @since 3.0.0
@@ -148,7 +153,7 @@ var Light = new Class({
148153
},
149154

150155
/**
151-
* [description]
156+
* Set the scroll factor of the light.
152157
*
153158
* @method Phaser.GameObjects.Light#setScrollFactor
154159
* @since 3.0.0
@@ -170,7 +175,7 @@ var Light = new Class({
170175
},
171176

172177
/**
173-
* [description]
178+
* Set the color of the light from a single integer RGB value.
174179
*
175180
* @method Phaser.GameObjects.Light#setColor
176181
* @since 3.0.0
@@ -182,21 +187,21 @@ var Light = new Class({
182187
setColor: function (rgb)
183188
{
184189
var color = Utils.getFloatsFromUintRGB(rgb);
185-
190+
186191
this.r = color[0];
187192
this.g = color[1];
188193
this.b = color[2];
189-
194+
190195
return this;
191196
},
192197

193198
/**
194-
* [description]
199+
* Set the intensity of the light.
195200
*
196201
* @method Phaser.GameObjects.Light#setIntensity
197202
* @since 3.0.0
198203
*
199-
* @param {number} intensity - [description]
204+
* @param {number} intensity - The intensity of the light.
200205
*
201206
* @return {Phaser.GameObjects.Light} This Light object.
202207
*/
@@ -208,7 +213,7 @@ var Light = new Class({
208213
},
209214

210215
/**
211-
* [description]
216+
* Set the position of the light.
212217
*
213218
* @method Phaser.GameObjects.Light#setPosition
214219
* @since 3.0.0
@@ -227,12 +232,12 @@ var Light = new Class({
227232
},
228233

229234
/**
230-
* [description]
235+
* Set the radius of the light.
231236
*
232237
* @method Phaser.GameObjects.Light#setRadius
233238
* @since 3.0.0
234239
*
235-
* @param {number} radius - [description]
240+
* @param {number} radius - The radius of the light.
236241
*
237242
* @return {Phaser.GameObjects.Light} This Light object.
238243
*/

0 commit comments

Comments
 (0)