gl-light

1.1.0 • Public • Published

gl-light

NPM version experimental js-standard-style

Create 3d lights for use with stack.gl.

install

npm install gl-light

example

Define data for your light

var data = {
  position: [0, 10, 20, 1]
}

Then create it

var light = require('gl-light')(data)

usage

light = require('gl-light')(data)

Create a light by providing data.

The following properties on data are required:

  • position a 3 or 4 vector with the position, with the fourth element specifying point or directional light, default [0, 0, 0, 1]

The fourth element of position specifies a point (1) or directional (0) light. If a 3 vector is passed, the fourth element will be set to 1.

light.attributes

All derived attributes are stored on light.attributes, and include:

  • position a 4 vector with the position in homogenous coordinates

light.position([x, y, z, [w]])

Update the position. If a 3 vector is passed, the fourth element will be kept the same.

Package Sidebar

Install

npm i gl-light

Weekly Downloads

1

Version

1.1.0

License

MIT

Last publish

Collaborators

  • freeman-lab