Javascript is a new languaje for me so this is a simple task that I cannot achieve. I can set the slider and update the position of my element when I change the slider with:
// Setup a ui.
webglLessonsUI.setupSlider("#x", {slide: updatePosition(0), max: gl.canvas.width });
webglLessonsUI.setupSlider("#y", {slide: updatePosition(1), max: gl.canvas.height});
Where update position is:
function updatePosition(index) {
return function(event, ui) {
translation[index] = ui.value;
drawScene();
};
}
But now I want just to set the value of the slider (because I have a back to default position function), and I am no able. I tried many things, such as:
webglLessonsUI.UpdateUI($('#x'), 0);
And:
$('#x').value = 0;
Or:
$('#x').slide = 0;
The tutorial where these UI components are used is this one:
https://webgl2fundamentals.org/webgl/lessons/webgl-2d-translation.html
And the ui componenents are here, can be used directly if link added to html, or even the tutorial itself (link above) has all the code needed to run the slider in the web itself.
https://webgl2fundamentals.org/webgl/resources/webgl-lessons-ui.js
Just want to manipulate the value of the slider directly. Any help is much appreciated, thanks