p5.js | specularColor() Function
The specularColor() function in p5.js is used to set the color of the specular highlight when it is used with the specular material and highlight.
This method is usually used with the specularMaterial() and shininess() functions to define the specular highlights. There would be no effect of this function without the specularMaterial() function. The default specular highlight color is white, if this function is not used.
specularColor( v1, v2, v3 )
specularColor( value )
specularColor( gray )
specularColor( values )
specularColor( color )
Parameters: This function accepts seven parameters as mentioned above and described below:
- v1: It is a number which determines the red or hue value relative to the current color range.
- v2: It is a number which determines the green or saturation value relative to the current color range.
- v3: It is a number which determines the blue or brightness value relative to the current color range.
- value: It is a string which defines the specular highlight color.
- gray: It is a number which defines the gray value of the specular highlight.
- values: It is an array of numbers which define the red, green, blue and alpha components of the specular highlight color.
- color: It is a p5.Color which defines the color of the specular highlight.
Below example illustrates the specularColor() function in p5.js:
Online editor: https://editor.p5js.org/