Skip to content

freeman-lab/gl-light

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

create 3d lights for use with stack.gl

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published