Point light
Introduction¶
A point light with gradient color in a circle.
- Author: Richard Davey
WebGL only
It only works in WebGL render mode.
Usage¶
Add point light¶
var pointLight = scene.add.pointlight(x, y, color, radius, intensity, attenuation);
x
,y
: The horizontal/vertical position of this Game Object in the world.color
: Color of this light.radius
: Radius of this light.intensity
:0
~1
, intensity of color.attenuation
:0
~1
, decay intensity along radius.
Position¶
- Set
or
pointLight.setPosition(x, y);
pointLight.x = x; pointLight.y = y;
- Get
var x = pointLight.x; var y = pointLight.y;
Color¶
- Set
- Red, green, blue
or
pointLight.color.set(red, green, blue);
pointLight.color.r = red; pointLight.color.g = green; pointLight.color.b = blue;
red
,green
,blue
:0
~1
.
- Red, green, blue
- Get
- Red, green, blue
var red = pointLight.color.r; var green = pointLight.color.g; var blue = pointLight.color.b;
red
,green
,blue
:0
~1
.
- Red, green, blue
Radius¶
- Set
pointLight.radius = radius;
- Get
var radius = pointLight.radius;
Intensity¶
- Set
pointLight.intensity = intensity;
- Get
var intensity = pointLight.intensity;
Attenuation¶
- Set
pointLight.attenuation = attenuation;
- Get
var attenuation = pointLight.attenuation;