Skip to content

Conversation

@benfoxall
Copy link
Member

@benfoxall benfoxall commented Jun 23, 2024

Adds a celebratory confetti effect to the homepage for the 50th Remote Hack event, respecting user preferences for reduced motion and only triggering under specific conditions.

  • Implements the confetti effect: Adds a new JavaScript file assets/confetti.js that creates a falling confetti effect using plain JavaScript. This effect respects the "prefers-reduced-motion" media query and automatically stops generating new confetti after 5 seconds.
  • Enables celebration condition: Modifies _hacks/50.md to include celebrate: true in the front matter, which is used to conditionally trigger the confetti effect.
  • Integrates the confetti script: Updates _layouts/default.html to conditionally include the confetti.js script based on the celebrate: true condition in the front matter of the event page.

For more details, open the Copilot Workspace session.

Comment on lines +53 to +57
setInterval(createConfetti, 100);

// Stop creating confettis after 5 seconds
setTimeout(() => {
clearInterval(createConfetti);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no interval id being stored, so it'll never stop 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can limit it easily to just the homepage then I think this is fine

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep I guess it is fine! I thought it was worth noting that the code from Copilot Workspace Preview has syntax issues 😓

confetti.y += confetti.speed;
confetti.x += Math.cos(confetti.angle) * confetti.speed;

// Remove confetti that are out of the screen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't do this, it is basically just a memory leak?

@benfoxall
Copy link
Member Author

@lpmi-13 I generated this PR using the Copilot Workspace Preview 😎 . It took me a few attempts to get this PR, and I think there's still some issues with it! Will try and fix it up and merge if I get a chance.

Screenshot 2024-06-23 at 12 18 39

@benfoxall
Copy link
Member Author

This was testing out copilot workspace, and there were a couple of issues with the implementation that I never ironed out. Also we're well past 50 now 🥳

@benfoxall benfoxall closed this Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants