The Color.set()
method sets the current color value based on the provided color.
set(color: Color | string | number): Color
color
: Color
| String
| Number
- The color value to set to. Can be a Color
instance, a string representing a color in hexadecimal notation, or a number representing a color in decimal notation.Color
- The Color
instance on which the method was called.Color
instanceconst red = new THREE.Color(0xff0000); // create a new Color instance representing the color red
const mesh = new THREE.Mesh(geometry, material);
mesh.material.color.set(red); // set the mesh's color to red
const mesh = new THREE.Mesh(geometry, material);
mesh.material.color.set('#00ff00'); // set the mesh's color to green
const mesh = new THREE.Mesh(geometry, material);
mesh.material.color.set(16711680); // set the mesh's color to red