Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Having a bit of trouble getting HSL colours to work with ThreeJs. Here's my code:
var exampleColor = new THREE.Color( 0xffffff );
exampleColor.setHSL( getHSLColour(exampleObject) );
var exampleMaterial = new THREE.MeshLambertMaterial ( {color: exampleColor} );
The output of getHSLColour is something like:
0.06721230158730158, 0.9913555194805196, 0.658271103896104
Which seems to match the format ThreeJs wants. But when I print exampleColor to the console, it still shows up as an RGB colour with NaN values:
T…E.Color {r: NaN, g: NaN, b: NaN}
What am I doing wrong?
setHSL
expects three different parameters, not an array:
var hsl = getHSLColour(exampleObject);
exampleColor.setHSL( hsl[0], hsl[1], hsl[2] );
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.