diff --git a/CSSRandom.js b/CSSRandom.js index 844514b..5ad1afb 100644 --- a/CSSRandom.js +++ b/CSSRandom.js @@ -1,4 +1,10 @@ -(function CSSRandom(){ - document.body.style.setProperty('--random',Math.random()) - requestAnimationFrame(CSSRandom) -})() \ No newline at end of file +const style=document.body.style +function CSSRandom(){ + style.setProperty('--random',Math.random()) + const timeout=style.getPropertyValue('--random-timeout') + if(timeout){ + setTimeout(CSSRandom,parseInt(timeout)) + }else{ + requestAnimationFrame(CSSRandom) + } +} \ No newline at end of file