Created
February 16, 2020 14:37
-
-
Save indatawetrust/2277675bc36afc3f4936b798cb62c4f3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const children = []; | |
const getChildren = el => [...el.children].map(child => { | |
getChildren(child); | |
child.style.transition = 'all ease 0.5s' | |
children.push(child); | |
}); | |
getChildren(document.body); | |
const getRandomElement = () => children[Math.floor(Math.random()*children.length)] | |
setInterval(() => { | |
const el = getRandomElement(); | |
el.style.opacity = 0.5 | |
el.style.transform = `rotate(${Math.floor(Math.random()*360)}deg) scale(1.25,1.25)` | |
setTimeout(() => { | |
el.style.opacity = 1; | |
el.style.transform = 'rotate(0deg) scale(1,1)' | |
}, 500) | |
}, 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment