Skip to content

Commit 71fa5ad

Browse files
committed
Add homebrew-legacy theme and legacy homepage
Introduce a new "homebrew-legacy" visual theme and legacy homepage. Adds stylesheet and sparkle canvas script assets under docs/assets and site/assets, implements a parchment-style legacy-home layout in site/index.html (replacing the previous content), and wires the new CSS/JS into 404, CLI, concepts, FAQ and install pages. Regenerates search_index.json to include the new homepage content.
1 parent 44c3d15 commit 71fa5ad

File tree

11 files changed

+1058
-167
lines changed

11 files changed

+1058
-167
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
(() => {
2+
const canvas = document.getElementById("sparkles");
3+
if (!canvas) {
4+
return;
5+
}
6+
7+
const ctx = canvas.getContext("2d");
8+
if (!ctx) {
9+
return;
10+
}
11+
12+
const reduced = globalThis.matchMedia && globalThis.matchMedia("(prefers-reduced-motion: reduce)").matches;
13+
let width = 0;
14+
let height = 0;
15+
let particles = [];
16+
const glyphs = ["✦", "✧", "⋆", "·", "✵", "✴", "⚝", "∗"];
17+
const count = reduced ? 20 : 55;
18+
19+
function rand(min, max) {
20+
return Math.random() * (max - min) + min;
21+
}
22+
23+
function resize() {
24+
width = canvas.width = globalThis.innerWidth;
25+
height = canvas.height = globalThis.innerHeight;
26+
}
27+
28+
function spawn() {
29+
return {
30+
x: rand(0, width),
31+
y: rand(-height * 0.6, height * 0.2),
32+
vy: rand(0.12, 0.45),
33+
vx: rand(-0.15, 0.15),
34+
life: 0,
35+
maxLife: rand(140, 320),
36+
size: rand(9, 18),
37+
glyph: glyphs[Math.floor(Math.random() * glyphs.length)],
38+
hue: rand(38, 52),
39+
};
40+
}
41+
42+
function init() {
43+
particles = [];
44+
for (let index = 0; index < count; index += 1) {
45+
const particle = spawn();
46+
particle.life = rand(0, particle.maxLife);
47+
particles.push(particle);
48+
}
49+
}
50+
51+
function draw() {
52+
ctx.clearRect(0, 0, width, height);
53+
for (const particle of particles) {
54+
const t = particle.life / particle.maxLife;
55+
let alpha = 1;
56+
57+
if (t < 0.15) {
58+
alpha = t / 0.15;
59+
} else if (t > 0.75) {
60+
alpha = (1 - t) / 0.25;
61+
}
62+
63+
ctx.globalAlpha = alpha * 0.75;
64+
ctx.fillStyle = `hsl(${particle.hue}, 90%, 72%)`;
65+
ctx.font = `${particle.size}px serif`;
66+
ctx.fillText(particle.glyph, particle.x, particle.y);
67+
68+
particle.x += particle.vx;
69+
particle.y += particle.vy;
70+
particle.life += 1;
71+
72+
if (particle.life >= particle.maxLife) {
73+
Object.assign(particle, spawn(), { life: 0 });
74+
}
75+
}
76+
77+
ctx.globalAlpha = 1;
78+
globalThis.requestAnimationFrame(draw);
79+
}
80+
81+
globalThis.addEventListener("resize", () => {
82+
resize();
83+
init();
84+
});
85+
86+
resize();
87+
init();
88+
draw();
89+
})();

0 commit comments

Comments
 (0)