add starts kv and background, fix some css
Some checks failed
Code quality checks / biome (push) Failing after 8s
Some checks failed
Code quality checks / biome (push) Failing after 8s
This commit is contained in:
parent
8b7bedbf0b
commit
83babb8c5c
5 changed files with 137 additions and 31 deletions
|
@ -1,3 +1,47 @@
|
||||||
|
.raindrop {
|
||||||
|
position: absolute;
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 50%;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.star,
|
||||||
|
.snowflake {
|
||||||
|
position: absolute;
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 50%;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.star {
|
||||||
|
animation: twinkle ease-in-out infinite alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shooting-star {
|
||||||
|
position: absolute;
|
||||||
|
background: linear-gradient(90deg, white, transparent);
|
||||||
|
width: 100px;
|
||||||
|
height: 2px;
|
||||||
|
opacity: 0.8;
|
||||||
|
border-radius: 2px;
|
||||||
|
transform-origin: left center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@keyframes twinkle {
|
||||||
|
from {
|
||||||
|
opacity: 0.3;
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* actual styles below */
|
||||||
body {
|
body {
|
||||||
font-family: system-ui, sans-serif;
|
font-family: system-ui, sans-serif;
|
||||||
background-color: var(--background);
|
background-color: var(--background);
|
||||||
|
@ -9,22 +53,6 @@ body {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.snowflake {
|
|
||||||
position: absolute;
|
|
||||||
background-color: white;
|
|
||||||
border-radius: 50%;
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.raindrop {
|
|
||||||
position: absolute;
|
|
||||||
background-color: white;
|
|
||||||
border-radius: 50%;
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hidden {
|
.hidden {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +66,7 @@ body {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
max-width: 600px;
|
max-width: 700px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +93,7 @@ body {
|
||||||
|
|
||||||
.badges {
|
.badges {
|
||||||
max-width: 700px;
|
max-width: 700px;
|
||||||
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
@ -226,7 +255,7 @@ ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 600px;
|
max-width: 700px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.activities {
|
.activities {
|
||||||
|
@ -234,7 +263,8 @@ ul {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 600px;
|
max-width: 700px;
|
||||||
|
box-sizing: border-box;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
67
public/js/stars.js
Normal file
67
public/js/stars.js
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
const container = document.createElement("div");
|
||||||
|
container.style.position = "fixed";
|
||||||
|
container.style.top = "0";
|
||||||
|
container.style.left = "0";
|
||||||
|
container.style.width = "100vw";
|
||||||
|
container.style.height = "100vh";
|
||||||
|
container.style.pointerEvents = "none";
|
||||||
|
container.style.overflow = "hidden";
|
||||||
|
container.style.zIndex = "9999";
|
||||||
|
document.body.appendChild(container);
|
||||||
|
|
||||||
|
for (let i = 0; i < 60; i++) {
|
||||||
|
const star = document.createElement("div");
|
||||||
|
const size = Math.random() * 2 + 1;
|
||||||
|
star.style.position = "absolute";
|
||||||
|
star.style.width = `${size}px`;
|
||||||
|
star.style.height = `${size}px`;
|
||||||
|
star.style.background = "white";
|
||||||
|
star.style.borderRadius = "50%";
|
||||||
|
star.style.opacity = Math.random();
|
||||||
|
star.style.top = `${Math.random() * 100}vh`;
|
||||||
|
star.style.left = `${Math.random() * 100}vw`;
|
||||||
|
star.style.animation = `twinkle ${Math.random() * 3 + 2}s infinite alternate ease-in-out`;
|
||||||
|
container.appendChild(star);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createShootingStar() {
|
||||||
|
const star = document.createElement("div");
|
||||||
|
star.classList.add("shooting-star");
|
||||||
|
|
||||||
|
let x = Math.random() * window.innerWidth * 0.8;
|
||||||
|
let y = Math.random() * window.innerHeight * 0.3;
|
||||||
|
const angle = Math.random() * Math.PI / 6 + Math.PI / 8;
|
||||||
|
const speed = 10;
|
||||||
|
const totalFrames = 60;
|
||||||
|
|
||||||
|
const deg = angle * (180 / Math.PI);
|
||||||
|
star.style.left = `${x}px`;
|
||||||
|
star.style.top = `${y}px`;
|
||||||
|
star.style.transform = `rotate(${deg}deg)`;
|
||||||
|
|
||||||
|
container.appendChild(star);
|
||||||
|
|
||||||
|
let frame = 0;
|
||||||
|
function animate() {
|
||||||
|
x += Math.cos(angle) * speed;
|
||||||
|
y += Math.sin(angle) * speed;
|
||||||
|
star.style.left = `${x}px`;
|
||||||
|
star.style.top = `${y}px`;
|
||||||
|
star.style.opacity = `${1 - frame / totalFrames}`;
|
||||||
|
|
||||||
|
frame++;
|
||||||
|
if (frame < totalFrames) {
|
||||||
|
requestAnimationFrame(animate);
|
||||||
|
} else {
|
||||||
|
container.removeChild(star);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
animate();
|
||||||
|
}
|
||||||
|
|
||||||
|
setInterval(() => {
|
||||||
|
if (Math.random() < 0.3) createShootingStar();
|
||||||
|
}, 1000);
|
||||||
|
});
|
|
@ -59,12 +59,15 @@ async function handler(request: ExtendedRequest): Promise<Response> {
|
||||||
mobile: presence.active_on_discord_mobile,
|
mobile: presence.active_on_discord_mobile,
|
||||||
web: presence.active_on_discord_web,
|
web: presence.active_on_discord_web,
|
||||||
},
|
},
|
||||||
instance,
|
instance: instance,
|
||||||
readme,
|
readme: readme,
|
||||||
allowSnow: presence.kv.snow === "true",
|
|
||||||
allowRain: presence.kv.rain === "true",
|
|
||||||
colors: colors?.colors ?? {},
|
|
||||||
badgeApi: badgeApi,
|
badgeApi: badgeApi,
|
||||||
|
colors: colors?.colors ?? {},
|
||||||
|
extraOptions: {
|
||||||
|
snow: presence.kv.snow === "true",
|
||||||
|
rain: presence.kv.rain === "true",
|
||||||
|
stars: presence.kv.stars === "true",
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return await renderEjsTemplate("index", ejsTemplateData);
|
return await renderEjsTemplate("index", ejsTemplateData);
|
||||||
|
|
|
@ -58,12 +58,15 @@ async function handler(): Promise<Response> {
|
||||||
mobile: presence.active_on_discord_mobile,
|
mobile: presence.active_on_discord_mobile,
|
||||||
web: presence.active_on_discord_web,
|
web: presence.active_on_discord_web,
|
||||||
},
|
},
|
||||||
instance,
|
instance: instance,
|
||||||
readme,
|
readme: readme,
|
||||||
allowSnow: presence.kv.snow === "true",
|
|
||||||
allowRain: presence.kv.rain === "true",
|
|
||||||
colors: colors?.colors ?? {},
|
|
||||||
badgeApi: badgeApi,
|
badgeApi: badgeApi,
|
||||||
|
colors: colors?.colors ?? {},
|
||||||
|
extraOptions: {
|
||||||
|
snow: presence.kv.snow === "true",
|
||||||
|
rain: presence.kv.rain === "true",
|
||||||
|
stars: presence.kv.stars === "true",
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return await renderEjsTemplate("index", ejsTemplateData);
|
return await renderEjsTemplate("index", ejsTemplateData);
|
||||||
|
|
|
@ -19,12 +19,15 @@
|
||||||
<link rel="stylesheet" href="/public/css/index.css">
|
<link rel="stylesheet" href="/public/css/index.css">
|
||||||
<script src="/public/js/index.js" defer></script>
|
<script src="/public/js/index.js" defer></script>
|
||||||
|
|
||||||
<% if (allowSnow) { %>
|
<% if (extraOptions.snow) { %>
|
||||||
<script src="/public/js/snow.js" defer></script>
|
<script src="/public/js/snow.js" defer></script>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if(allowRain) { %>
|
<% if(extraOptions.rain) { %>
|
||||||
<script src="/public/js/rain.js" defer></script>
|
<script src="/public/js/rain.js" defer></script>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
<% if (extraOptions.stars) { %>
|
||||||
|
<script src="/public/js/stars.js" defer></script>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<meta name="color-scheme" content="dark">
|
<meta name="color-scheme" content="dark">
|
||||||
</head>
|
</head>
|
||||||
|
|
Loading…
Add table
Reference in a new issue