Skip to content

Commit 00b3c31

Browse files
committed
Throw some confetti on Git's 20th birthday
But only once, and only on the front page, please. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 99cc909 commit 00b3c31

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

assets/js/application.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,30 @@ var GitTurns20 = {
138138

139139
celebrate: function() {
140140
document.documentElement.dataset.celebration = 'git-turns-20';
141+
if ($("#masthead").length) { // only do this on the front page
142+
(async () => {
143+
await import('https://cdn.jsdelivr.net/npm/[email protected]/dist/confetti.browser.min.js');
144+
const count = 200;
145+
const defaults = {
146+
origin: { y: 0.7 },
147+
disableForReducedMotion: true,
148+
};
149+
150+
for (const [particleRatio, opts] of [
151+
[0.25, { spread: 26, startVelocity: 55 }],
152+
[0.2, { spread: 60 }],
153+
[0.35, { spread: 100, decay: 0.91, scalar: 0.8 }],
154+
[0.1, { spread: 120, startVelocity: 25, decay: 0.92, scalar: 1.2 }],
155+
[0.1, { spread: 120, startVelocity: 45 }],
156+
]) {
157+
window.confetti({
158+
...defaults,
159+
...opts,
160+
particleCount: Math.floor(count * particleRatio)
161+
});
162+
}
163+
})().catch(console.error);
164+
}
141165
}
142166
};
143167

0 commit comments

Comments
 (0)