", {"class" : "Oscillator"})
.appendTo(container);
this.oscillator = oscillator;
this.label = $("
", {"id" : "Label"})
.appendTo(this.element)
.text(label);
this.type = new GUI.DropDown(this.element, ["sine", "square", "sawtooth", "triangle"], function(option){
oscillator.setType(option);
});
};
GUI.Oscillator.prototype.render = function(){
var type = this.oscillator.getType();
this.type.select(type);
};
/**
* SLIDER + VALUE
*/
GUI.Slider = function(container, callback, initial, label, units){
this.element = $("
", {"class" : "Slider"})
.appendTo(container);
this.slider = $("
", {"id" : "Input"})
.appendTo(this.element)
.slider({
"min" : 0,
"max" : 1000,
"slide" : this.onslide.bind(this),
"change" : this.onslide.bind(this)
});
this.value = new GUI.Value(this.element, initial, label, units);
this.callback = callback;
};
GUI.Slider.prototype.onslide = function(e, ui){
var val = ui.value / 1000;
var ret = this.callback(val);
if (ret !== undefined){
this.value.setValue(ret);
} else {
this.value.setValue(val);
}
};
GUI.Slider.prototype.render = function(value){
this.slider.slider({"value" : value * 1000});
};