Skip to content

Commit 4f54399

Browse files
mcculleytechclaude
andcommitted
add subtle particle effect across site
Floating white dots on a fixed canvas behind content for ambient depth on the dark navy background. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a20d69f commit 4f54399

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

layouts/partials/extended_head.html

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,62 @@
5454
.ai-disclaimer p {
5555
margin: 0;
5656
}
57+
58+
#particles {
59+
position: fixed;
60+
top: 0;
61+
left: 0;
62+
width: 100%;
63+
height: 100%;
64+
pointer-events: none;
65+
z-index: 0;
66+
}
5767
</style>
68+
69+
<script>
70+
document.addEventListener('DOMContentLoaded', function() {
71+
var canvas = document.createElement('canvas');
72+
canvas.id = 'particles';
73+
document.body.appendChild(canvas);
74+
var ctx = canvas.getContext('2d');
75+
var particles = [];
76+
var count = 60;
77+
78+
function resize() {
79+
canvas.width = window.innerWidth;
80+
canvas.height = window.innerHeight;
81+
}
82+
resize();
83+
window.addEventListener('resize', resize);
84+
85+
for (var i = 0; i < count; i++) {
86+
particles.push({
87+
x: Math.random() * canvas.width,
88+
y: Math.random() * canvas.height,
89+
r: Math.random() * 1.5 + 0.5,
90+
dx: (Math.random() - 0.5) * 0.3,
91+
dy: (Math.random() - 0.5) * 0.3,
92+
o: Math.random() * 0.4 + 0.1
93+
});
94+
}
95+
96+
function draw() {
97+
ctx.clearRect(0, 0, canvas.width, canvas.height);
98+
for (var i = 0; i < particles.length; i++) {
99+
var p = particles[i];
100+
ctx.beginPath();
101+
ctx.arc(p.x, p.y, p.r, 0, Math.PI * 2);
102+
ctx.fillStyle = 'rgba(255,255,255,' + p.o + ')';
103+
ctx.fill();
104+
p.x += p.dx;
105+
p.y += p.dy;
106+
if (p.x < 0) p.x = canvas.width;
107+
if (p.x > canvas.width) p.x = 0;
108+
if (p.y < 0) p.y = canvas.height;
109+
if (p.y > canvas.height) p.y = 0;
110+
}
111+
requestAnimationFrame(draw);
112+
}
113+
draw();
114+
});
115+
</script>

0 commit comments

Comments
 (0)