Skip to content

Commit

Permalink
✨ feat: 축하 애니메이션 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
khr0923 committed May 1, 2024
1 parent f511632 commit a2bd924
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/dinosaur/dinosaur.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ function updateGameContent() {
<div id="count-down" class="count-down hide">
<p id="count-number">0</p>
</div>
`;

loadScript("js/dinosaur/main.js");
loadScript('https://cdn.jsdelivr.net/npm/canvas-confetti@1.9.3/dist/confetti.browser.min.js');
}

function loadScript(src) {
Expand Down
8 changes: 8 additions & 0 deletions js/dinosaur/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
const buttons = gameControls.querySelectorAll("button");
const coinDino = document.querySelector("#coin");
game.classList.remove("hide");


let dinoAccountValues = {
score: 0,
lines: 0,
Expand Down Expand Up @@ -657,7 +659,12 @@
scoreElement.textContent = `${Math.round(score.score)} - ${score.name}`;
rankingList.appendChild(scoreElement);
if (index === 0 && isNewTopScore) {
console.log(isNewTopScore);
scoreElement.classList.add("flash-effect");

confetti({
particleCount: 130
});
}
});

Expand Down Expand Up @@ -702,6 +709,7 @@
break;
case "Enter":
// 선택된 버튼의 클릭 이벤트를 강제 실행
confetti.reset();
modalButtons[modalCurrentButtonIndex].click();
break;
}
Expand Down

0 comments on commit a2bd924

Please sign in to comment.