Illuminated.js Docs (v0.1)

A 2D lights and shadows rendering engine for your HTML5 web applications and games.
Show:

illuminated.Lighting Class

Module: illuminated

Defines the lighting of one light through a set of opaque objects.

Constructor

illuminated.Lighting

(
  • [options]
)

Parameters:

  • [options] Object optional

    Options to be applied to this light.

Item Index

Properties

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 CanvasRenderingContext2D

    The canvas context onto which the shadows will be drawn.

compute

(
  • w
  • h
)

Compute the shadows to cast.

Parameters:

  • w Number

    Width of the canvas context.

  • h Number

    Height of the canvas context.

createCache

(
  • w
  • h
)
private

Create caches for canvas contexts.

Parameters:

  • w Number

    Width of the contexts.

  • h Number

    Height of the contexts.

render

(
  • ctx
)

Draws the light and shadows onto the given context.

Parameters:

  • ctx CanvasRenderingContext2D

    The 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: []