-
-
Save parzibyte/69068e6292d3d3bc4456d82c9403ce6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const encenderYApagarBoton = async (boton, duracion) => { | |
puedeJugar = false; | |
const colorActual = boton.attr("fill"); | |
let sonidoQueSeReproduce; | |
if (compararBotones(boton, superiorIzquierda)) { | |
sonidoQueSeReproduce = sonidoSuperiorIzquierda; | |
} else if (compararBotones(boton, superiorDerecha)) { | |
sonidoQueSeReproduce = sonidoSuperiorDerecha; | |
} else if (compararBotones(boton, inferiorIzquierda)) { | |
sonidoQueSeReproduce = sonidoInferiorIzquierda | |
} else { | |
sonidoQueSeReproduce = sonidoInferiorDerecha; | |
} | |
sonidoQueSeReproduce.currentTime = 0; | |
await sonidoQueSeReproduce.play(); | |
boton.attr("fill", d3.color(colorActual).brighter(gamma)) | |
await sleep(duracion); | |
boton.attr("fill", d3.color(colorActual)); | |
await sleep(duracion); | |
await sonidoQueSeReproduce.pause(); | |
puedeJugar = true; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment