feat: add button click effect
This commit is contained in:
@@ -23,7 +23,7 @@ prompts = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
model = modal.Cls.lookup("infinifi", "Model")
|
# model = modal.Cls.lookup("infinifi", "Model")
|
||||||
|
|
||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
@@ -75,7 +75,7 @@ def advance():
|
|||||||
else:
|
else:
|
||||||
current_index = current_index + 1
|
current_index = current_index + 1
|
||||||
|
|
||||||
threading.Thread(target=generate_new_audio).start()
|
# threading.Thread(target=generate_new_audio).start()
|
||||||
|
|
||||||
t = threading.Timer(60, advance)
|
t = threading.Timer(60, advance)
|
||||||
t.start()
|
t.start()
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
const playBtn = document.getElementById("play-btn");
|
const playBtn = document.getElementById("play-btn");
|
||||||
const catImg = document.getElementsByClassName("cat")[0];
|
const catImg = document.getElementsByClassName("cat")[0];
|
||||||
|
const clickAudio = new Audio("/audio/click.wav");
|
||||||
|
const clickReleaseAudio = new Audio("/audio/click-release.wav");
|
||||||
|
|
||||||
const CROSSFADE_DURATION_MS = 5000;
|
const CROSSFADE_DURATION_MS = 5000;
|
||||||
const CROSSFADE_INTERVAL_MS = 20;
|
const CROSSFADE_INTERVAL_MS = 20;
|
||||||
@@ -81,6 +83,17 @@ function animateCat() {
|
|||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
playBtn.onmousedown = () => {
|
||||||
|
clickAudio.play();
|
||||||
|
document.addEventListener(
|
||||||
|
"mouseup",
|
||||||
|
() => {
|
||||||
|
clickReleaseAudio.play();
|
||||||
|
},
|
||||||
|
{ once: true },
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
playBtn.onclick = () => {
|
playBtn.onclick = () => {
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
pauseAudio();
|
pauseAudio();
|
||||||
|
Reference in New Issue
Block a user