Skip to content

Commit 175c079

Browse files
authored
Merge pull request #2 from worstprgr/main
added dynamic variation to the fart sfx, so it does not sound static
2 parents 0b20bb2 + 09ade36 commit 175c079

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@ const farts = [
88

99
function playFart(fart) {
1010
fart.currentTime = 0;
11+
fart.playbackRate = randomPlaybackRate();
12+
fart.preservesPitch = false;
1113
fart.play();
1214
shaking = true;
1315
}
1416

17+
function randomPlaybackRate(min = 0.98, max = 1.02) {
18+
return Math.random() * (max - min) + min;
19+
}
20+
1521
const eventsTable = [
1622
{
1723
onCount: 0,

0 commit comments

Comments
 (0)