The invert
function allows you to get a negative color.
This function returns a new Spectrum
instance representing the inverted color.
Usage
Parameters
invert(color1Obj, weight)
Parameter | Type | Required | Valid range | Description |
---|
colorObj | Spectrum instance | true | - | The initial color |
weight | number | true | [0; 1] | The weight of the inverted color in the result |
Return Value
The invert
function returns a new Spectrum
instance representing the negative color.
Examples
Weight is 0.5
When the weight
value is equal to 0.5 (50% of initial color and 50% of inverted color),
it will always produce grey color (#808080
).
Weight is 0