mirror of
https://github.com/System-End/site.git
synced 2026-04-19 22:05:11 +00:00
[arcade] Fix mute toggle
This commit is contained in:
parent
de45024f12
commit
6fbdc0feab
2 changed files with 16 additions and 2 deletions
|
|
@ -6,6 +6,9 @@
|
|||
<title>Power Hour: Arcade</title>
|
||||
<link rel="icon" type="image/x-icon" href="https://cloud-n6tkrqcbc-hack-club-bot.vercel.app/0favicon.png">
|
||||
|
||||
<script>
|
||||
let muted = true
|
||||
</script>
|
||||
<!-- <style href="style.css"></style> -->
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<script src="data-loader.js"></script>
|
||||
|
|
@ -64,7 +67,7 @@
|
|||
handleClick({ name: "Dino", flavorText: selfClicks["Dino"] })
|
||||
})
|
||||
|
||||
document.querySelector('.sound-button').addEventListener('click', toggleMusic)
|
||||
document.querySelector('.sound-button').addEventListener('click', toggleMute)
|
||||
|
||||
function handleClick(inv) {
|
||||
let msg = sample(inv.flavorText)
|
||||
|
|
@ -128,6 +131,16 @@
|
|||
rate: 0.5
|
||||
})
|
||||
|
||||
async function toggleMute() {
|
||||
muted = !muted
|
||||
if (muted) {
|
||||
document.querySelector('.sound-button').textContent = 'Want sound?'
|
||||
} else if (!muted) {
|
||||
document.querySelector('.sound-button').textContent = 'Mute sound'
|
||||
}
|
||||
toggleMusic()
|
||||
}
|
||||
|
||||
async function toggleMusic() {
|
||||
if (firstPlay) {
|
||||
// strange fade-in effect where the pitch shifts up like a record player
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@ async function yap(text, {
|
|||
endCallback = () => {},
|
||||
baseRate = 1.9,
|
||||
rateVariance = 0.50,
|
||||
volume = 0.50
|
||||
}) {
|
||||
let volume = 0.2
|
||||
if (muted) { endCallback(); return }
|
||||
const yap_sounds = {
|
||||
// these sounds and most of the yapping code are adapted from https://github.com/equalo-official/animalese-generator
|
||||
a: new Howl({ src: '/bin/yapping/a.wav', volume }),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue