illuminated.Lighting Class
Defines the lighting of one light through a set of opaque objects.
Constructor
illuminated.Lighting
-
[options]
Parameters:
-
[options]
Object optionalOptions to be applied to this light.
-
[light]
illuminated.Light optionalThe source of the lighting.
-
[objects]
Array optionalAn array of illuminated.OpaqueObject objects which stop the light and create shadows.
-
Methods
cast
-
ctxoutput
Draw the shadows that are cast by the objects. You usually don't have to use it if you use render().
Parameters:
-
ctxoutput
CanvasRenderingContext2DThe canvas context onto which the shadows will be drawn.
compute
-
w
-
h
Compute the shadows to cast.
Parameters:
-
w
NumberWidth of the canvas context.
-
h
NumberHeight of the canvas context.
createCache
-
w
-
h
Create caches for canvas contexts.
Parameters:
-
w
NumberWidth of the contexts.
-
h
NumberHeight of the contexts.
render
-
ctx
Draws the light and shadows onto the given context.
Parameters:
-
ctx
CanvasRenderingContext2DThe canvas context on which to draw.
Properties
light
Light
The source of the lighting.
Default: new illuminated.Light()
objects
Array
An array of illuminated.OpaqueObject objects which stop the light and create shadows.
Default: []