Make play/pause button toggle shapes
This commit is contained in:
parent
e58e440a12
commit
91d2b205c9
|
@ -8,7 +8,7 @@ headers:
|
||||||
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button id="play" class="big">⏯️</button>
|
<button id="play" class="big">▶️</button>
|
||||||
<span>
|
<span>
|
||||||
🔉
|
🔉
|
||||||
<input id="fader" type="range" min="0" max="10" step="0.01" />
|
<input id="fader" type="range" min="0" max="10" step="0.01" />
|
||||||
|
|
|
@ -40,11 +40,14 @@ function init() {
|
||||||
document.querySelector("#fader").addEventListener("input", setFade);
|
document.querySelector("#fader").addEventListener("input", setFade);
|
||||||
setFade();
|
setFade();
|
||||||
|
|
||||||
document.querySelector("#play").addEventListener("click", e => {
|
let play = document.querySelector("#play");
|
||||||
|
play.addEventListener("click", e => {
|
||||||
if (audioCtx.state == "running") {
|
if (audioCtx.state == "running") {
|
||||||
audioCtx.suspend();
|
audioCtx.suspend();
|
||||||
|
play.textContent = "▶️️";
|
||||||
} else {
|
} else {
|
||||||
audioCtx.resume();
|
audioCtx.resume();
|
||||||
|
play.textContent = "⏸️";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue