-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
63 lines (57 loc) · 1.77 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta property="og:title" content="Ayyyy lmao" />
<meta property="og:image" content="favicon.png">
<meta property="og:description" content="It's lit" />
<link rel="icon" type="image/png" href="favicon.png">
<title>Ayyyy lmao</title>
</head>
<body>
<canvas id="canvas"></canvas>
<style>
html, body, canvas {
height: 100vh;
width: 100vw;
margin: 0;
padding: 0;
}
#canvas {
image-rendering: auto;
display: block;
}
</style>
<script>
const emojis = ['😂', '🔥', '👌', '💯', '🍞'];
const scale = devicePixelRatio;
const w = window.innerWidth;
const h = window.innerHeight;
const canvas = document.getElementById('canvas');
canvas.width = w * scale;
canvas.height = h * scale;
const ctx = canvas.getContext('2d');
ctx.imageSmoothingEnabled = false;
ctx.scale(scale, scale);
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min; // The maximum is exclusive and the minimum is inclusive
}
function draw() {
const fontSize = (((Math.random() * 48) | 0) + 16) + 'px';
const emoji = emojis[getRandomInt(0, emojis.length)];
const x = getRandomInt(0, w);
const y = getRandomInt(0, h);
const rotation = getRandomInt(-20, 20);
ctx.font = `${fontSize} sans-serif`;
ctx.rotate(rotation);
ctx.fillText(emoji, x, y);
setTimeout(draw, Math.random() * 10);
}
draw();
</script>
</body>
</html>