This commit is contained in:
josephsmendoza
2022-12-03 16:42:36 +00:00
parent cbc0822b88
commit e84919d462
37 changed files with 14514 additions and 11 deletions
+8 -11
View File
@@ -1,11 +1,8 @@
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)
}
}
CSSRandom()
/**
* On import, sets the global css variable `--random` to `Math.random()` before each draw
* @module CSSRandom
*/
(function CSSRandom() {
document.documentElement.style.setProperty('--random', Math.random())
requestAnimationFrame(CSSRandom)
})()