Skip to content

Instantly share code, notes, and snippets.

@lulu-berlin
Last active November 12, 2017 01:03
Show Gist options
  • Save lulu-berlin/c1b464ef7d7f495f39af7e46ac15f14d to your computer and use it in GitHub Desktop.
Save lulu-berlin/c1b464ef7d7f495f39af7e46ac15f14d to your computer and use it in GitHub Desktop.
Cheesie Cake v4.0
license: cc-by-4.0
border: no
height: 800
<!doctype html>
<head>
<meta charset="utf-8">
<title>Cheesie Cake v4.0</title>
<meta name="description" content="A Cheesie Website for a Cheesie Mood"/>
<meta name="author" content="Ya'ar Hever"/>
<style type="text/css">
body {
background-color: crimson;
overflow: hidden;
}
#cheese {
display: inline-block;
white-space: pre-wrap;
word-break: break-all;
}
</style>
</head>
<body>
<div id="cheese"></div>
<script type="text/javascript" src="https://twemoji.maxcdn.com/2/twemoji.min.js?2.3.1"></script>
<script type="text/javascript">
var HEART1 = 55357, HEART2 = 56459;
function charsInView(cheese, callback) {
cheese.innerHTML = twemoji.parse(String.fromCharCode(HEART1, HEART2 + 10));
setTimeout(
function() {
var rect = cheese.getBoundingClientRect();
cheese.innerHTML = '';
callback(Math.floor(window.innerHeight / rect.height) * Math.floor(window.innerWidth / rect.width));
},
100
);
}
var timer = null;
window.onload = window.onresize = function() {
if (timer) {
clearInterval(timer);
timer = null;
}
var cheese = document.querySelector("#cheese");
charsInView(
cheese,
function(n) {
var charCodeArray = Array.apply(null, Array(n << 1));
timer = setInterval(
function() {
charCodeArray.forEach(
function(_, i) {
charCodeArray[i] = i % 2 === 0 ? HEART1 : HEART2 + ~~(Math.random() * 21);
}
)
document.querySelector("#cheese").innerHTML = twemoji.parse(
String.fromCharCode.apply(null, charCodeArray)
);
},
300
);
}
);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment