-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
56 lines (50 loc) · 1.91 KB
/
script.js
File metadata and controls
56 lines (50 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* Matrix rain effect */
(function () {
const canvas = document.getElementById('matrix-canvas');
const ctx = canvas.getContext('2d');
let cols, drops;
const CHARS = 'アイウエオカキクケコサシスセソタチツテトナニヌネノ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const FS = 14;
function init() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
cols = Math.floor(canvas.width / FS);
drops = Array.from({ length: cols }, () => Math.random() * -100);
}
function draw() {
ctx.fillStyle = 'rgba(0,0,0,0.04)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = '#00ff41';
ctx.font = FS + 'px monospace';
for (let i = 0; i < drops.length; i++) {
const ch = CHARS[Math.floor(Math.random() * CHARS.length)];
ctx.fillText(ch, i * FS, drops[i] * FS);
if (drops[i] * FS > canvas.height && Math.random() > 0.975) drops[i] = 0;
drops[i]++;
}
}
init();
window.addEventListener('resize', init);
setInterval(draw, 45);
})();
/* Ripple effect on click */
document.querySelectorAll('.pill-card').forEach(card => {
card.addEventListener('click', function(e) {
const ripple = document.createElement('span');
const color = this.classList.contains('blue') ? 'rgba(26,143,255,0.6)' : 'rgba(255,34,51,0.6)';
Object.assign(ripple.style, {
position: 'fixed',
left: (e.clientX - 50) + 'px',
top: (e.clientY - 50) + 'px',
width: '100px',
height: '100px',
borderRadius: '50%',
background: color,
pointerEvents: 'none',
zIndex: '999',
animation: 'rippleOut 0.6s ease-out forwards'
});
document.body.appendChild(ripple);
setTimeout(() => ripple.remove(), 700);
});
});