-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs.js
88 lines (67 loc) · 2.65 KB
/
js.js
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
document.addEventListener('DOMContentLoaded', () => {
//-----------------------------------------------------------------------frontbg--------------------------------------------------------------------
// Initialising the canvas
var canvas = document.querySelector('#frontbg'),
ctx = canvas.getContext('2d');
// Setting the width and height of the canvas
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
// Setting up the letters
var letters = 'DELTA';
letters = letters.split('');
// Setting up the columns
var fontSize = 20,
columns = canvas.width / fontSize;
// Setting up the drops
var drops = [];
for (var i = 0; i < columns; i++) {
drops[i] = 1;
}
// Setting up the draw function
function draw() {
ctx.fillStyle = 'rgba(0, 0, 0, 0.1)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
for (var i = 0; i < drops.length; i++) {
var text = letters[Math.floor(Math.random() * letters.length)];
ctx.fillStyle = 'white';
ctx.fillText(text, i * fontSize, drops[i] * fontSize);
drops[i]++;
if (drops[i] * fontSize > canvas.height && Math.random() > .95) {
drops[i] = 0;
}
}
}
setInterval(draw, 50);
});
//-----------------------------------------------------------------------audio--------------------------------------------------------------------
document.addEventListener('DOMContentLoaded', () => {
window.onload = function() {
const audio1 = document.getElementById('myAudio');
audio1.play();
};
});
// Function to toggle audio mute/unmute
function toggleMute() {
var audio = document.getElementById('myAudio');
const icon1 = document.querySelector('.playButton_1 i');
if (audio.muted) {
audio.muted = false;
audio.play(); // Ensure it's playing when unmuted
icon1.classList.remove('fa-volume-xmark');
icon1.classList.add('fa-volume-high');
icon1.classList.add('rot_anime');
} else {
audio.muted = true;
icon1.classList.remove('fa-volume-high');
icon1.classList.add('fa-volume-xmark');
icon1.classList.remove('rot_anime');
}
}
toggleMute()
//-----------------------------------------------------------------------img--------------------------------------------------------------------
const gallery = document.querySelectorAll('img');
gallery.forEach(img => {
img.addEventListener('click', () => {
window.open(img.src, '_blank');
});
});