Illuminated.js Docs (v0.1)

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

illuminated.OpaqueObject Class

Module: illuminated

Abstract class for opaque objects.

Constructor

illuminated.OpaqueObject

(
  • [options]
)

Parameters:

  • [options] Object optional

    Options to be applied to this opaque object.

    • [diffuse] Number optional

      How diffuse this opaque object should be.

Item Index

Properties

Methods

bounds

() Object

Calculate the boundaries of this opaque object.

Returns:

Object: An anonymous object with the properties topleft and bottomright. The property values are illuminated.Vec2 objects representing the corners of the boundary.

cast

(
  • ctx
  • origin
  • bounds
)

Fill ctx with the shadows projected by this opaque object at the origin point, constrained by the given bounds.

Parameters:

  • ctx CanvasRenderingContext2D

    The canvas context onto which the shadows will be cast.

  • origin illuminated.Vec2

    A vector that represents the origin for the casted shadows.

  • bounds Object

    An anonymous object with the properties topleft and bottomright. The property values are illuminated.Vec2 objects representing the corners of the boundary.

contains

(
  • point
)
Boolean

Determine if the given point is inside the object.

Parameters:

Returns:

Boolean: True if the opaque object contains the given point.

path

(
  • ctx
)

Draw the path of the opaque object shape onto the ctx.

Parameters:

  • ctx CanvasRenderingContext2D

    The context onto which the path will be drawn.

Properties

diffuse

Number

How diffuse this opaque object should be.

Default: 0.8