Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has Three.js setHSL() been deprecated?

I'm looking for any way possible to implement an HSL color scheme in my threejs project. I don't see anything after 2013 in the documentation that implements the .setHSL() or .offsetHSL().

What is the best/easiest way to use only HSL in a threejs scene? Thanks!

like image 907
EJW Avatar asked Oct 23 '25 18:10

EJW


1 Answers

.setHSL ( h, s, l ) this

h — hue value between 0.0 and 1.0
s — saturation value between 0.0 and 1.0
l — lightness value between 0.0 and 1.0

Sets color from hsl


.getHSL () hsl

Returns an object with properties h, s, and l.


.offsetHSL ( h, s, l ) this

Adds given h, s, and l to this color's existing h, s, and l values.

three.js - reference - color

var color = new THREE.Color();
color.setHSL( .74, .64, .59 );
console.log('HSL Object:', color.getHSL());
console.log('Hex String:', color.getHexString());
console.log('RGB:', color.getStyle());
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r79/three.js"></script>
like image 118
ksav Avatar answered Oct 26 '25 07:10

ksav