Skip to content

Commit 126be21

Browse files
committed
add randomness to header links
1 parent a15e1d1 commit 126be21

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

index.animated.html

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
color: #aaa;
2929
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
3030
Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
31-
font-weight: 600;
31+
font-weight: 700;
3232
padding: 1rem;
3333
text-decoration: none;
3434
user-select: none;
@@ -46,15 +46,27 @@
4646
</style>
4747

4848
<header>
49-
<a href="mailto:gabrielj.harel@gmail.com">contact</a>
50-
<a href="https://github.com/g-harel/blobs">github</a>
51-
<a href="https://npmjs.com/package/blobs">npm</a>
49+
<a class="randomized" href="mailto:gabrielj.harel@gmail.com">CONTACT</a>
50+
<a class="randomized" href="https://npmjs.com/package/blobs">NPM</a>
51+
<a class="randomized" href="https://github.com/g-harel/blobs">GITHUB</a>
5252
</header>
5353

5454
<main>
5555
<canvas id="canvas"></canvas>
5656
</main>
5757

58+
<script>
59+
// Randomly rotate and move elements with "randomized" class.
60+
const randomize = (elem) => {
61+
elem.style.display = "inline-block";
62+
elem.style.transform = `
63+
rotate(${-3 + 6 * Math.random()}deg)
64+
translate(${-5 + 10 * Math.random()}px, ${-5 + 10 * Math.random()}px)
65+
`;
66+
};
67+
Array.from(document.querySelectorAll(".randomized")).map(randomize);
68+
</script>
69+
5870
<script>
5971
// Set blob size relative to window, but limit to 600.
6072
const size = Math.min(600, window.innerWidth - 64);

0 commit comments

Comments
 (0)