Illuminated.js Docs (v0.1)

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

illuminated.DiscObject Class

A circular, opaque object.

Constructor

illuminated.DiscObject

(
  • [options]
)

Parameters:

  • [options] Object optional

    Options to be applied to this disc object.

    • [center] illuminated.Vec2 optional

      Position of the disc object.

    • [radius] Number optional

      Size of the disc object.

    • [diffuse] Number optional

      How diffuse this disc object should be.

Item Index

Properties

Methods

bounds

() Object

Inherited from illuminated.OpaqueObject but overwritten in src/illuminated.js:748

Calculate the boundaries of this disc 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
)

Inherited from illuminated.OpaqueObject but overwritten in src/illuminated.js:689

Fill ctx with the shadows projected by this disc object from 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

Inherited from illuminated.OpaqueObject but overwritten in src/illuminated.js:762

Determine if the given point is inside the disc.

Parameters:

Returns:

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

path

(
  • ctx
)

Inherited from illuminated.OpaqueObject but overwritten in src/illuminated.js:738

Draw the path of the disc onto the ctx.

Parameters:

  • ctx CanvasRenderingContext2D

    The context onto which the path will be drawn.

Properties

center

Vec2

Position of the disc object.

Default: new illuminated.Vec2()

diffuse

Number

How diffuse this opaque object should be.

Default: 0.8

radius

Number

Size of the disc object.

Default: 20