Class: Light

Light()

 Light
   - Register every Light instance to a LightRenderer
     with LightRenderer.registerLight
     and unregister with LightRenderer.unregisterLight

Constructor

new Light()

Creates an instance of Light.
Properties:
Name Type Description
type number Type of the Light
maxShadowStep number The maximum step of shadow caster per pixel - Default value is 128
reflectionSize number Reflection size
precision number Shadow precision - Default value is 1
angle number Rotation of the light
spotAngle number Angle of the light source - Default value is 180deg [hemisphere] - 360deg [sphere]
Source:

Extends

Classes

Light

Members

callback :function

 Set/Get render callback
   - It will be called when the Item is rendered
Type:
  • function
Overrides:
Source:

castShadow :boolean

Set/Get shadow casting
Type:
  • boolean
Source:

centerReflection :boolean

Set/Get is the reflection moves towards the center of the screen
Type:
  • boolean
Source:

colorProofReflection :boolean

 Set/Get the surface reflects the color of the light
   - If it is false the surface reflects white color
Type:
  • boolean
Source:

flattenShadow :boolean

 Set/Get flatten the shadow
   - Cast shadow if true and a pixel is higher or equal than the light z position
   - Cast shadow if false and a pixel is higher than the light z position
Type:
  • boolean
Source:

parent :Container

Set/Get parent
Type:
Overrides:
Source:

shading :boolean

Set/Get shading
Type:
  • boolean
Source:

(readonly) stage :StageContainer

Get StageContainer
Type:
Overrides:
Source:

(static) Type

Light type
Properties:
Name Type Description
POINT number Like a lamp light source
DIRECTIONAL number Like sunlight
Source:

Methods

callEventHandler(event)

 Handle event
   - It can handle mouse events if the item is interactive and has [onmouseover, onmouseout, onmousemove, onmousedown, onmouseup, onclick, ontouchstart, ontouchmove, touchend] function
Parameters:
Name Type Description
event *
Overrides:
Source:

destruct()

Destruct class
Overrides:
Source:

getBounds() → {Rectangle}

Returns with bounds
Overrides:
Source:
Returns:
Type
Rectangle

getCorners() → {Array.<Point>}

Returns with the calculated corder positions
Overrides:
Source:
Returns:
Type
Array.<Point>

isOn() → {boolean}

Returns true if the light is renderable
Source:
Returns:
Type
boolean

update()

Update Light properties
Overrides:
Source: