Skip to content

Commit e89dd21

Browse files
committed
added confetti
1 parent 378c536 commit e89dd21

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

confetti.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
</div>
1515
<button id="pause" onclick="pauseTimer()">Pause</button>
1616
</div>
17+
<script defer src="confetti.js"></script>
1718
<script>
1819
function animationInterval(ms, signal, callback) {
1920
const start = 0;
@@ -52,7 +53,6 @@
5253
function timerCallback(startDate, currentDate) {
5354
const diff = (currentDate - startDate) / 1000;
5455
remainingSeconds = totalSeconds - diff;
55-
console.log("help");
5656

5757
console.log(remainingSeconds);
5858
if (remainingSeconds < 0) {
@@ -64,10 +64,10 @@
6464
function setText(seconds) {
6565
if (seconds > 60) {
6666
timerElem.innerText = Math.floor(seconds / 60);
67-
textElem.innerText = pluralizer(" minute", seconds / 60);
67+
textElem.innerText = pluralizer(" minute", Math.floor(seconds / 60));
6868
} else if (seconds > 0) {
6969
timerElem.innerText = Math.floor(seconds);
70-
textElem.innerText = pluralizer(" second", seconds);
70+
textElem.innerText = pluralizer(" second", Math.floor(seconds));
7171
}
7272
}
7373

@@ -82,13 +82,12 @@
8282

8383
function endTimer() {
8484
controller.abort();
85-
console.log("called");
8685
audio = new Audio("./ding.ogg");
8786
audio.play();
87+
confetti({ origin: { y: 1 }, startVelocity: 70, particleCount: 100, disableForReducedMotion: true });
8888
}
8989

9090
function startTimer(interval) {
91-
console.log("hi");
9291
animationInterval(interval, controller.signal, timerCallback);
9392
}
9493

0 commit comments

Comments
 (0)