Commit db4c54d3 authored by amandaghassaei's avatar amandaghassaei
Browse files

default colors

parent 24351ecc
......@@ -422,8 +422,8 @@
Colored Material
</label>
<div id="coloredMaterialOptions" class="indent">
<label>Frontside Color (rgb hex): </label><input value="" placeholder="" class="form-control" type="text"><br/>
<label>Backside Color (rgb hex): </label><input value="" placeholder="" class="form-control" type="text"><br/>
<label>Color 1 (rgb hex): </label><input id="color1" value="" placeholder="" class="form-control" type="text"><br/>
<label>Color 2 (rgb hex): </label><input id="color2" value="" placeholder="" class="form-control" type="text"><br/>
</div>
<label class="radio">
<input name="colorMode" value="normal" data-toggle="radio" class="custom-radio" type="radio"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>
......
......@@ -77,6 +77,13 @@ function initControls(globals){
globals.model.setMeshMaterial();
});
setHexInput("#color1", globals.color1, function(val){
globals.color1 = val;
});
setHexInput("#color2", globals.color2, function(val){
globals.color2 = val;
});
function setButtonGroup(id, callback){
$(id+" a").click(function(e){
e.preventDefault();
......@@ -123,6 +130,16 @@ function initControls(globals){
$input.val(val);
}
function setHexInput(id, val, callback){
var $input = $(id);
$input.change(function(){
var val = $input.val();
$input.val(val);
callback(val);
});
$input.val(val);
}
function setCheckbox(id, state, callback){
var $input = $(id);
$input.on('change', function () {
......
......@@ -9,6 +9,8 @@ function initGlobals(){
//view
colorMode: "normal",
color1: "ec008b",
color2: "ffffff",
//flags
fixedHasChanged: false,
......
......@@ -15,6 +15,8 @@ function initModel(globals){
new THREE.MeshLambertMaterial({shading:THREE.FlatShading, color:0xff0000, side:THREE.FrontSide}),
new THREE.MeshLambertMaterial({shading:THREE.FlatShading, color:0x0000ff, side:THREE.FrontSide})
]);
material.materials[0].color.setStyle( "#" + globals.color1);
material.materials[1].color.setStyle( "#" + globals.color2);
}
if (object3D) object3D.material = material;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment