Make play/pause button toggle shapes

This commit is contained in:
Neale Pickett 2018-11-21 22:22:41 +00:00
parent e58e440a12
commit 91d2b205c9
2 changed files with 5 additions and 2 deletions

View File

@ -8,7 +8,7 @@ headers:
<div>
<button id="play" class="big"></button>
<button id="play" class="big"></button>
<span>
🔉
<input id="fader" type="range" min="0" max="10" step="0.01" />

View File

@ -40,11 +40,14 @@ function init() {
document.querySelector("#fader").addEventListener("input", setFade);
setFade();
document.querySelector("#play").addEventListener("click", e => {
let play = document.querySelector("#play");
play.addEventListener("click", e => {
if (audioCtx.state == "running") {
audioCtx.suspend();
play.textContent = "▶️️";
} else {
audioCtx.resume();
play.textContent = "⏸️";
}
});