Skip to content

Instantly share code, notes, and snippets.

@indatawetrust
Created February 16, 2020 14:37
Show Gist options
  • Save indatawetrust/2277675bc36afc3f4936b798cb62c4f3 to your computer and use it in GitHub Desktop.
Save indatawetrust/2277675bc36afc3f4936b798cb62c4f3 to your computer and use it in GitHub Desktop.
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