Skip to content

color(...)

Studio is being deprecated, please head over to the documentation page for Mattercraft, our most advanced 3D tool for the web, where you can find the most recent information and tutorials.

color(val : number[]) : this;

Sets the current color value of the node, in the form [r, g, b, a]. Each component is a number between 0 and 1.

The final component, alpha, is the opacity of the object, where 0 is fully transparent and 1 is fully opaque.

Default value: [1, 1, 1, 1]

ParameterTypeDescription
valnumber[]The value to set the color to, in the following form: [r, g, b, a].

this

myobject.color([1, 0, 0, 1]);
// myobject is now red