-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunused.ts
104 lines (79 loc) · 2.41 KB
/
unused.ts
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Currently unused, may re-add in future
/**/
//// Random Sounds
/**/
// Making sounds
const soundArr: HTMLAudioElement[] = [];
const cartoonpop = new Audio("./sounds/cartoonpop.mp4");
soundArr.push(cartoonpop);
const crow = new Audio("./sounds/crow.mp4");
soundArr.push(crow);
const hover = new Audio("./sounds/hover.mp4");
soundArr.push(hover);
const pop = new Audio("./sounds/pop.mp4");
soundArr.push(pop);
const retrolaser = new Audio("./sounds/retrolaser.mp4");
soundArr.push(retrolaser);
const scifiui = new Audio("./sounds/scifiui.mp4");
soundArr.push(scifiui);
const synthglide = new Audio("./sounds/synthglide.mp4");
soundArr.push(synthglide);
const stopAllSounds = (): void => {
soundArr.forEach((item) => {
item.pause();
item.currentTime = 0;
});
};
const playRandomSound = (): void => {
soundArr[Math.floor(Math.random() * soundArr.length)].play();
};
const muteAudio = (): void => {
soundArr.forEach((sound) => (sound.muted = true));
};
const unMuteAudio = (): void => {
soundArr.forEach((sound) => (sound.muted = false));
};
const toggleMute = (): void => {
const muteBtn = document.getElementById("toggle-mute") as HTMLButtonElement;
if (muteBtn.innerText === "Mute") {
muteAudio();
muteBtn.innerText = "Unmute";
} else {
unMuteAudio();
muteBtn.innerText = "Mute";
}
};
/**/
//// Random Flower Mode
/**/
// const toggleRandom = () => {
// const toggleRandBtn = document.getElementById("toggle-random") as HTMLButtonElement;
// if (toggleRandBtn.innerText === "Draw") {
// canvas.removeEventListener("click", placeRandFlower);
// canvas.addEventListener("click", placeFlower);
// toggleRandBtn.innerText = "Random";
// } else {
// canvas.removeEventListener("click", placeFlower);
// canvas.addEventListener("click", placeRandFlower);
// toggleRandBtn.innerText = "Draw";
// }
// };
// const getRandLoc = (): [number, number] => {
// const x = Math.floor(Math.random() * canvas.width);
// const y = Math.floor(Math.random() * canvas.height);
// return [x, y];
// };
// const placeRandFlower = () => {
// const randFlower = flowerArr[Math.floor(Math.random() * flowerArr.length)];
// const randXY = getRandLoc();
// const imageSize = 150;
// ctx.drawImage(
// randFlower,
// randXY[0] - imageSize / 2,
// randXY[1] - imageSize / 2,
// imageSize,
// imageSize
// );
// stopAllSounds();
// playRandomSound();
// };