maxwell-triangle
v1.0.1
Published
Get color values inside a Maxwell triangle from positions and vice versa.
Downloads
14
Readme
maxwell-triangle
Get color values inside a Maxwell triangle from positions and vice versa.
Installation
npm install maxwell-triangle
Usage
import MaxwellTriangle from "maxwell-triangle";
const maxwellTriangle = new MaxwellTriangle(512);
// Get the value at the bottom center of the triangle
const value = maxwellTriangle.getValue(256, 512);
API
MaxwellTriangle
Create a Maxwell Triangle
Kind: global class
- MaxwellTriangle
- .getValue(x, y) ⇒ Array.<number>
- .getPoint(r, g, b) ⇒ Array.<number>
maxwellTriangle.getValue(x, y) ⇒ Array.<number>
Get a [r, g, b] value at x/y position in the given size
Kind: instance method of MaxwellTriangle
| Param | Type | | ----- | ------------------- | | x | number | | y | number |
maxwellTriangle.getPoint(r, g, b) ⇒ Array.<number>
Get a x/y position from r, g, b values
Kind: instance method of MaxwellTriangle
| Param | Type | | ----- | ------------------- | | r | number | | g | number | | b | number |
License
MIT. See license file.