I am trying to add GUI in my program for some sliders and color options. I tried with the similar code in all sample examples provided. But still, I am unable to add GUI. Please look at my code and try to give me solution ASAP if possible. A big thanks in advance.
My JavaScript code is given below.
`
// GLobal variables
let angle = 0;
let fabric;
let wood;
let floor;
var rotateXAxis = 0;
var rotateYAxis = 0;
var rotateZAxis = 0;
`
// set slider range with magic variables
var rotateXAxisMin = 0;
var rotateXAxisMax = 500;
// set angle range and step with magic variables
var rotateYAxisMin = 0;
var rotateYAxisMax = 500;
// set radius range and step with magic variables
var rotateZAxisMin = 0;
var rotateZAxisMax = 500;
//var radiusStep = 0.1;
`
var visible = true;
var gui;
function setup() {
createCanvas(1520, 640, WEBGL);
var t = translateSlider.value(); var r = rotateSlider.value(); var sc = scaleSlider.value(); var sh = sHearSlider.value();
//noStroke(); ..... I think its useful
function keyPressed() {
if (keyCode === LEFT_ARROW) {
value = 255;
}
if (keyCode === RIGHT_ARROW) {
value = 0;
}
if (keyCode === UP_ARROW) {
value = 0;
}
if (keyCode === DOWN_ARROW) {
value = 0;
}
}
function windowResized() {
resizeCanvas(1520, 640);
}`
I am trying to add GUI in my program for some sliders and color options. I tried with the similar code in all sample examples provided. But still, I am unable to add GUI. Please look at my code and try to give me solution ASAP if possible. A big thanks in advance.
My JavaScript code is given below.
` // GLobal variables
let angle = 0;
let fabric; let wood; let floor;
var rotateXAxis = 0; var rotateYAxis = 0; var rotateZAxis = 0;
` // set slider range with magic variables var rotateXAxisMin = 0; var rotateXAxisMax = 500;
// set angle range and step with magic variables var rotateYAxisMin = 0; var rotateYAxisMax = 500;
// set radius range and step with magic variables var rotateZAxisMin = 0; var rotateZAxisMax = 500; //var radiusStep = 0.1; ` var visible = true; var gui;
function setup() { createCanvas(1520, 640, WEBGL);
sliderRange(0, 90, 1); gui = createGui('Function Rotate'); gui.addGlobals('myColor', 'myAngle');
noLoop();
}
function preload() { fabric = loadImage('texture/royal_blue.jpg'); wood = loadImage('texture/wood.jpg'); floor = loadImage('texture/floor2.jpg'); }
function draw() {
var t = translateSlider.value(); var r = rotateSlider.value(); var sc = scaleSlider.value(); var sh = sHearSlider.value();
//noStroke(); ..... I think its useful}
function keyPressed() { if (keyCode === LEFT_ARROW) { value = 255; } if (keyCode === RIGHT_ARROW) { value = 0; } if (keyCode === UP_ARROW) { value = 0;
} if (keyCode === DOWN_ARROW) { value = 0; } }
function windowResized() { resizeCanvas(1520, 640); }`