@anglefeint/astro-theme 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -0
- package/package.json +38 -0
- package/public/scripts/about-effects.js +535 -0
- package/public/scripts/blogpost-effects.js +956 -0
- package/public/scripts/home-matrix.js +117 -0
- package/public/styles/about-page.css +756 -0
- package/public/styles/blog-post.css +390 -0
- package/public/styles/home-page.css +186 -0
- package/src/assets/theme/placeholders/theme-placeholder-1.jpg +0 -0
- package/src/assets/theme/placeholders/theme-placeholder-2.jpg +0 -0
- package/src/assets/theme/placeholders/theme-placeholder-3.jpg +0 -0
- package/src/assets/theme/placeholders/theme-placeholder-4.jpg +0 -0
- package/src/assets/theme/placeholders/theme-placeholder-5.jpg +0 -0
- package/src/assets/theme/placeholders/theme-placeholder-about.jpg +0 -0
- package/src/assets/theme/red-queen/theme-redqueen1.webp +0 -0
- package/src/assets/theme/red-queen/theme-redqueen2.gif +0 -0
- package/src/cli-new-page.mjs +118 -0
- package/src/cli-new-post.mjs +139 -0
- package/src/components/BaseHead.astro +177 -0
- package/src/components/Footer.astro +74 -0
- package/src/components/FormattedDate.astro +17 -0
- package/src/components/Header.astro +328 -0
- package/src/components/HeaderLink.astro +35 -0
- package/src/consts.ts +12 -0
- package/src/content-schema.ts +33 -0
- package/src/i18n/config.ts +46 -0
- package/src/i18n/messages.ts +220 -0
- package/src/i18n/posts.ts +11 -0
- package/src/index.ts +5 -0
- package/src/layouts/BasePageLayout.astro +67 -0
- package/src/layouts/BlogPost.astro +279 -0
- package/src/layouts/HomePage.astro +73 -0
- package/src/styles/global.css +1867 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const chars =
|
|
3
|
+
'!"#$%&\'()*+,-./:;<=>?[\\]^_{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
4
|
+
const matrixFont =
|
|
5
|
+
'"Matrix Code NFI", "Atkinson", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
|
|
6
|
+
const MAX_DPR = 2;
|
|
7
|
+
|
|
8
|
+
const canvas = document.getElementById('matrix-bg');
|
|
9
|
+
if (!(canvas instanceof HTMLCanvasElement)) return;
|
|
10
|
+
|
|
11
|
+
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
|
12
|
+
canvas.style.display = 'none';
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const ctx = canvas.getContext('2d');
|
|
17
|
+
if (!ctx) return;
|
|
18
|
+
|
|
19
|
+
let animationId = 0;
|
|
20
|
+
let lastTime = 0;
|
|
21
|
+
let lastFrameTime = 0;
|
|
22
|
+
const cols = [];
|
|
23
|
+
const fontSize = 22;
|
|
24
|
+
const speed = 80;
|
|
25
|
+
const trailLen = 18;
|
|
26
|
+
const fpsInput = Number(canvas.dataset.matrixFps ?? window.__ANGLEFEINT_MATRIX_FPS ?? 45);
|
|
27
|
+
const matrixFps = Number.isFinite(fpsInput) ? Math.min(60, Math.max(15, fpsInput)) : 45;
|
|
28
|
+
const frameIntervalMs = 1000 / matrixFps;
|
|
29
|
+
let width = 0;
|
|
30
|
+
let height = 0;
|
|
31
|
+
|
|
32
|
+
function randomChar() {
|
|
33
|
+
return chars[Math.floor(Math.random() * chars.length)];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function resize() {
|
|
37
|
+
const dpr = Math.min(MAX_DPR, window.devicePixelRatio || 1);
|
|
38
|
+
width = window.innerWidth;
|
|
39
|
+
height = window.innerHeight;
|
|
40
|
+
canvas.width = Math.round(width * dpr);
|
|
41
|
+
canvas.height = Math.round(height * dpr);
|
|
42
|
+
canvas.style.width = `${width}px`;
|
|
43
|
+
canvas.style.height = `${height}px`;
|
|
44
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
45
|
+
cols.length = 0;
|
|
46
|
+
for (let i = 0; i < Math.ceil(width / fontSize); i += 1) {
|
|
47
|
+
const y = Math.random() * height;
|
|
48
|
+
const row = Math.floor(y / fontSize);
|
|
49
|
+
cols[i] = {
|
|
50
|
+
y,
|
|
51
|
+
drops: [{ y: row * fontSize, c: randomChar() }],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function draw(now) {
|
|
57
|
+
if (lastFrameTime && now - lastFrameTime < frameIntervalMs) {
|
|
58
|
+
animationId = window.requestAnimationFrame(draw);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
lastFrameTime = now;
|
|
62
|
+
const dt = lastTime ? (now - lastTime) / 200 : 0;
|
|
63
|
+
lastTime = now;
|
|
64
|
+
|
|
65
|
+
ctx.fillStyle = '#000';
|
|
66
|
+
ctx.fillRect(0, 0, width, height);
|
|
67
|
+
ctx.font = `${fontSize}px ${matrixFont}`;
|
|
68
|
+
|
|
69
|
+
for (let i = 0; i < cols.length; i += 1) {
|
|
70
|
+
const col = cols[i];
|
|
71
|
+
const x = Math.round(i * fontSize);
|
|
72
|
+
|
|
73
|
+
const prevRow = Math.floor(col.y / fontSize);
|
|
74
|
+
col.y += speed * dt;
|
|
75
|
+
const currRow = Math.floor(col.y / fontSize);
|
|
76
|
+
|
|
77
|
+
for (let row = prevRow + 1; row <= currRow; row += 1) {
|
|
78
|
+
const dropY = row * fontSize;
|
|
79
|
+
col.drops.unshift({ y: dropY, c: randomChar() });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
while (col.drops.length > trailLen) col.drops.pop();
|
|
83
|
+
|
|
84
|
+
for (let j = col.drops.length - 1; j >= 0; j -= 1) {
|
|
85
|
+
const opacity = j === 0 ? 1 : 0.2 + 0.6 * (1 - j / trailLen);
|
|
86
|
+
ctx.fillStyle = `rgba(0, 255, 65, ${opacity})`;
|
|
87
|
+
ctx.fillText(col.drops[j].c, x, col.drops[j].y);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (col.y > height && Math.random() > 0.975) {
|
|
91
|
+
col.y = 0;
|
|
92
|
+
col.drops = [{ y: 0, c: randomChar() }];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
animationId = window.requestAnimationFrame(draw);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
resize();
|
|
100
|
+
animationId = window.requestAnimationFrame(draw);
|
|
101
|
+
window.addEventListener('resize', resize);
|
|
102
|
+
|
|
103
|
+
document.addEventListener('visibilitychange', () => {
|
|
104
|
+
if (document.hidden) {
|
|
105
|
+
window.cancelAnimationFrame(animationId);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
lastTime = 0;
|
|
109
|
+
lastFrameTime = 0;
|
|
110
|
+
animationId = window.requestAnimationFrame(draw);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
document.addEventListener('mousemove', (event) => {
|
|
114
|
+
document.body.style.setProperty('--matrix-mx', `${event.clientX}px`);
|
|
115
|
+
document.body.style.setProperty('--matrix-my', `${event.clientY}px`);
|
|
116
|
+
});
|
|
117
|
+
})();
|