Skip to content

Commit

Permalink
Added confetti to badge page
Browse files Browse the repository at this point in the history
  • Loading branch information
prafulla-codes committed Nov 13, 2021
1 parent b6d2551 commit e9f1775
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 28 deletions.
25 changes: 0 additions & 25 deletions confetti.html

This file was deleted.

4 changes: 2 additions & 2 deletions confetti.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var confetti = {
maxCount: 150, //set max confetti count
speed: 2, //set the particle animation speed
frameInterval: 15, //the confetti animation frame interval in milliseconds
frameInterval: 30, //the confetti animation frame interval in milliseconds
alpha: 1.0, //the alpha opacity of the confetti (between 0 and 1, where 1 is opaque and 0 is invisible)
gradient: false, //whether to use gradients for the confetti particles
start: null, //call to start confetti animation (with optional timeout in milliseconds, and optional min and max random confetti count)
Expand Down Expand Up @@ -103,7 +103,7 @@ var confetti = {
if (canvas === null) {
canvas = document.createElement("canvas");
canvas.setAttribute("id", "confetti-canvas");
canvas.setAttribute("style", "display:block;z-index:999999;pointer-events:none;position:fixed;top:0");
canvas.setAttribute("style", "display:block;z-index:999999;z-index:0;pointer-events:none;position:fixed;top:0");
document.body.prepend(canvas);
canvas.width = width;
canvas.height = height;
Expand Down
5 changes: 4 additions & 1 deletion hat.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ class Hat {
document.documentElement.style.setProperty("--page-color", color);

badgePage.style.animation = "3s appear forwards ease";

setTimeout(()=> {
confetti.start()
confetti.speed = 1;
},3000);
}
think(ANIM_TIME){
let thoughts = document.getElementById("thoughts");
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ <h3 id="thoughts"></h3>
<p class="star"></p>
</div>
</div>
<script src="./confetti.js"></script>
<script src="hat.js"></script>
<script src="index.js"></script>
</body>
Expand Down

0 comments on commit e9f1775

Please sign in to comment.