1
0
mirror of https://github.com/sendevia/website.git synced 2026-03-06 15:42:34 +08:00

feat: replace random bullet rotation with stable deterministic rotation

This commit is contained in:
2025-10-23 19:06:27 +08:00
parent bb0bb6ce20
commit 5df3835004

View File

@@ -24,13 +24,13 @@ function copyAnchorLink(this: HTMLElement) {
function ulCustomBullets() {
const listItems = document.querySelectorAll("ul li");
listItems.forEach((li) => {
const randomRotation = Math.floor(Math.random() * 360) - 180;
listItems.forEach((li, index) => {
const stableRotation = ((index * 137) % 360) - 180;
const computedStyle = window.getComputedStyle(li);
const lineHeight = parseFloat(computedStyle.lineHeight);
const bulletTop = lineHeight / 2 - 8;
(li as HTMLElement).style.setProperty("--random-rotation", `${randomRotation}deg`);
(li as HTMLElement).style.setProperty("--random-rotation", `${stableRotation}deg`);
(li as HTMLElement).style.setProperty("--bullet-top", `${bulletTop}px`);
});
}