I need to update the color after receiving the value from dat.GUI . But, this
var colored = new THREE.Color(value.replace("#","0x"));
is throwing this warning "THREE.Color: Unknown color 0x002dff" and the 'colored' isn't updating.
value = #002dff (at that time, it keeps on changing, user input)
Edit: I know I can use this as "THREE.Color( #002dff )", but the color is changing at run time according to the user input from controls I've created using dat.GUI, so I won't be knowing the actual value that can be added to the code.
PS: It was replace()
which was causing the problem. It's solved.
You have to give a hexadecimal number, not a string to the Color
constructor. Try to call the parseInt
function:
var colorValue = parseInt ( value.replace("#","0x"), 16 );
var colored = new THREE.Color( colorValue );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With