Answer the question
In order to leave comments, you need to log in
How to change background color in three.js using dat.GUI?
i have a code
var option_default = function() {
this.colr_scene = '#C8C7C7';
};
var option_array = new option_default();
var opt_none ;
var gui = new dat.GUI({ autoPlace: false });
var action_colr_scene = gui.addColor(option_array_ise, 'colr_scene');
action_colr_scene.onChange(function(opt_none){renderer.setClearColor.color.setHex(opt_none.replace("#", "0x"));});
var renderer = new THREE.WebGLRenderer();
renderer.setClearColor (0xC8C7C7 );
var cotl2 = '0xC8C7C7' ;
renderer.setClearColor (cotl2 );
alert(renderer.setClearColor);
function(){
[][][]background.setClearColor.apply(background, arguments);
[][]}
Answer the question
In order to leave comments, you need to log in
I found this solution to the problem
action_colr_scene.onChange( function (opt_none) {
scene.background.setHex(opt_none.replace("#", "0x"));
} );
scene.background = new THREE.Color(0xff00ff);
And the color should not be specified in hex by any chance? #000000 - in this format
See documentation . setClearColor can only take a Color object
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question