Illuminated.js Docs (v0.1)

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

illuminated Class

Module: illuminated

Item Index

Methods

Methods

createCanvasAnd2dContext

(
  • w
  • h
)
Object static

Creates a canvas and context with the given width and height.

Parameters:

  • w Number

    Width of the canvas context.

  • h Number

    Height of the canvas context.

Returns:

Object: An anonymous object with "canvas", "ctx", "w" and "h" properties.

extend

(
  • mergeInto
  • mergeFrom
)
static

Merges the properties from the given parameters into the first parameter.

Parameters:

  • mergeInto Object

    An object to merge into.

  • mergeFrom Object multiple

    Objects to merge from.

extractColorAndAlpha

(
  • color
)
Object static

Converts a CSS color string into an anonymous object with color and alpha properties.

Parameters:

  • color String

    Color in any CSS format.

Returns:

Object: An anonymous object with the properties color and alpha. The color property is a string in hex format and the alpha property is a number from 0.0 to 1.0, rounded to 3 decimal places.

getRGBA

(
  • color
  • alpha
)
String static

Converts a CSS color string into RGBA format.

Parameters:

  • color String

    Color in any CSS format.

  • alpha Number

    Alpha value for produced color.

Returns:

String: Color in RGBA format.

path

(
  • ctx
  • points
  • dontJoinLast
)
static

Draw a path defined by the given points onto the given ctx.

Parameters:

  • ctx CanvasRenderingContext2D

    The context onto which the properties should be drawn.

  • points Array

    An array of illuminated.Vec2 objects that define the path.

  • dontJoinLast Boolean

    True if the last point should joined with the first point in the path.