-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
77 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<div class="flex-1 flex flex-col items-center justify-center"> | ||
<p id="text-404">404</p> | ||
<p class="text-gray-500 text-lg font-light"> | ||
Page Not Found. | ||
<a href="/" class="shadow-link">Go home?</a> | ||
</p> | ||
</div> | ||
|
||
<script type="module"> | ||
const text404 = document.getElementById("text-404"); | ||
const gradient = getComputedStyle(text404).backgroundImage; | ||
const shadowColor = getComputedStyle(text404).getPropertyValue("--text-shadow").split(",")[0].replace("1px 1px", "").trim(); | ||
|
||
function normalizeOffset(xOffset, yOffset) { | ||
const length = Math.sqrt(xOffset ** 2 + yOffset ** 2); | ||
const effLength = Math.min(length / 200, 1) | ||
return [xOffset / length * effLength, yOffset / length * effLength]; | ||
} | ||
|
||
|
||
function layerShadow(xOffset, yOffset) { | ||
// Repeat 10 times, with increasing offset and color | ||
return [...Array(10).keys()].map((i) => | ||
`${xOffset * i}px ${yOffset * i}px ${shadowColor}` | ||
).join(", "); | ||
} | ||
|
||
document.addEventListener("mousemove", function (e) { | ||
const box = text404.getBoundingClientRect(); | ||
const [xOffset, yOffset] = normalizeOffset( | ||
(box.left + box.right) / 2 - e.clientX, | ||
(box.top + box.bottom) / 2 - e.clientY | ||
); | ||
const shadow = layerShadow(xOffset, yOffset); | ||
const angle = Math.atan2(yOffset, xOffset) - Math.PI * 1 / 2; | ||
text404.style.backgroundImage = gradient.replace("to right bottom", `${angle}rad`); | ||
text404.style.setProperty("--text-shadow", shadow); | ||
}, false); | ||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ | |
<meta property="og:type" content="website" /> | ||
<meta property="og:site_name" content="Berkeley Math Tournament" /> | ||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css"> | ||
<link rel="preconnect" href="https://rsms.me/"> | ||
<link rel="stylesheet" href="https://rsms.me/inter/inter.css"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"> | ||
|
@@ -67,7 +67,7 @@ | |
</head> | ||
|
||
<body> | ||
<div class="max-w-4xl p-4 md:p-8 mx-auto flex flex-col gap-4 md:gap-8"> | ||
<div class="max-w-4xl min-h-screen p-4 md:p-8 mx-auto flex flex-col gap-4 md:gap-8"> | ||
{% block header %} | ||
<header class="flex flex-col gap-4 text-center"> | ||
<a class="mx-auto" href="/"><img src="/assets/logo.png" alt="BMT Logo" width="80"></a> | ||
|
@@ -88,7 +88,7 @@ | |
|
||
<hr> | ||
|
||
<div class="flex flex-col gap-4 md:gap-8"> | ||
<div class="flex-1 flex flex-col gap-4 md:gap-8"> | ||
{% block content %}{% endblock %} | ||
</div> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters