Skip to content

Instantly share code, notes, and snippets.

@joshkautz
Last active September 8, 2016 04:31
Show Gist options
  • Save joshkautz/651020844385cb53f9c42036313e78b4 to your computer and use it in GitHub Desktop.
Save joshkautz/651020844385cb53f9c42036313e78b4 to your computer and use it in GitHub Desktop.
JavaScript to randomly animate all the smiley face emojis supported in-browser, accompanied by relevant HTML display files.
<!DOCTYPE html>
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html, body {
height: 100%;
}
body {
display:flex;
justify-content:center;
align-items:center;
font-size: 200px;
overflow: hidden;
}
</style>
<script src="emoji_animation.js"></script>
</head>
<body></body>
</html>
var emojis = '๐Ÿ˜€ ๐Ÿ˜ฌ ๐Ÿ˜ ๐Ÿ˜‚ ๐Ÿ˜ƒ ๐Ÿ˜„ ๐Ÿ˜… ๐Ÿ˜† ๐Ÿ˜‡ ๐Ÿ˜‰ ๐Ÿ˜Š ๐Ÿ™‚ โ˜บ๏ธ ๐Ÿ˜‹ ๐Ÿ˜Œ ๐Ÿ˜ ๐Ÿ˜˜ ๐Ÿ˜— ๐Ÿ˜™ ๐Ÿ˜š ๐Ÿ˜œ ๐Ÿ˜ ๐Ÿ˜› ๐Ÿ˜Ž ๐Ÿ˜ ๐Ÿ˜ถ ๐Ÿ˜ ๐Ÿ˜‘ ๐Ÿ˜’ ๐Ÿ˜ณ ๐Ÿ˜ž ๐Ÿ˜Ÿ ๐Ÿ˜  ๐Ÿ˜ก ๐Ÿ˜” ๐Ÿ˜• ๐Ÿ™ โ˜น๏ธ ๐Ÿ˜ฃ ๐Ÿ˜– ๐Ÿ˜ซ ๐Ÿ˜ฉ ๐Ÿ˜ค ๐Ÿ˜ฎ ๐Ÿ˜ฑ ๐Ÿ˜จ ๐Ÿ˜ฐ ๐Ÿ˜ฏ ๐Ÿ˜ฆ ๐Ÿ˜ง ๐Ÿ˜ข ๐Ÿ˜ฅ ๐Ÿ˜ช ๐Ÿ˜“ ๐Ÿ˜ญ ๐Ÿ˜ต ๐Ÿ˜ฒ ๐Ÿ˜ท ๐Ÿ˜ด'.split( ' ' );
function animate() {
setTimeout( function () {
document.body.textContent = emojis[ Math.floor( Math.random() * emojis.length ) ];
requestAnimationFrame( animate );
}, 100 )
}
requestAnimationFrame( animate );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment