Created
July 14, 2022 18:32
-
-
Save stoyan/eaa436661f55a7e01b23c85149763a4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let i = document.querySelector('input.waterfall-transparency'); | |
let up = true; | |
i.value = parseFloat(i.min); | |
i.dispatchEvent(new Event('change')); | |
function animate() { | |
const curr = parseFloat(i.value); | |
const max = parseFloat(i.max); | |
const min = parseFloat(i.min); | |
const step = parseFloat(i.step); | |
i.value = up ? curr + step : curr - step; | |
i.dispatchEvent(new Event('change')); | |
if (parseFloat(i.value) === max || parseFloat(i.value) === min) { | |
up = !up; | |
} | |
} | |
let inter = setInterval(animate, 20); | |
//clearTimeout(inter); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment