Fix that slider bug

This commit is contained in:
Logan Hunt 2022-06-19 01:50:01 -07:00
parent 982b863802
commit a028e009d6
Signed by untrusted user who does not match committer: simponic
GPG Key ID: 52B3774857EB24B1

View File

@ -1,7 +1,7 @@
const MIN_ZOOM = 0.0001;
const MAX_ZOOM = 4;
const C_THRESHOLD = Math.sqrt(2)/2;
const SLIDER_DIV = 1000*C_THRESHOLD;
const SLIDER_DIV = 2000*C_THRESHOLD;
const gpu = new GPU();
const buildRender = (width, height) => gpu.createKernel(function (maxIterations, cr, ci, centerX, centerY, zoom, colorMultipliers) {
@ -81,6 +81,7 @@ const startAnim = (sliderId, complexComponentName='ci') => {
};
const start = setInterval(() => {
if (state[complexComponentName] >= C_THRESHOLD) {
console.log("OVER", C_THRESHOLD);
restart(start);
}
@ -90,12 +91,12 @@ const startAnim = (sliderId, complexComponentName='ci') => {
document.getElementById(sliderId).onclick = ()=>restart(start);
};
document.getElementById('realSlider').oninput = function() {
state.changes.cr = parseFloat(this.value) / SLIDER_DIV;
};
document.getElementById('imaginarySlider').oninput = function() {
state.changes.ci = parseFloat(this.value) / SLIDER_DIV;
};
document.getElementById('realSlider').oninput = function() {
state.changes.cr = parseFloat(this.value) / SLIDER_DIV;
};
document.getElementById('imag-val').addEventListener('change', function (e) {
state.changes.ci = parseFloat(this.value);