-
Notifications
You must be signed in to change notification settings - Fork 0
Add colorful fireworks particle system with p5.js #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done |
✅ I finished the code review, and didn't find any security or code quality issues. |
Co-authored-by: LeoAndo <16476224+LeoAndo@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a standalone HTML page that uses p5.js to display colorful, physics-based fireworks with both automatic and click-triggered launches, accompanied by bilingual instructions and responsive design.
- Introduces
fireworks.html
embedding CSS and JavaScript with p5.js for particle simulation - Defines
Firework
andParticle
classes to manage launch, explosion, physics, color, and trail - Enables automatic launches at random intervals and click-based targeting, with adaptive canvas resizing
Comments suppressed due to low confidence (2)
fireworks.html:152
- [nitpick] The parameters 'firework' and 'hu' are ambiguous. Consider renaming them to 'isRocket' and 'hue' for clearer intent.
constructor(x, y, firework, hu) {
fireworks.html:85
- [nitpick] The
Firework
andParticle
classes lack documentation for their constructor parameters and methods. Adding JSDoc comments would clarify their intended usage and behavior.
class Firework {
|
||
explode() { | ||
// 爆発時に多数の粒子を生成 | ||
for (let i = 0; i < random(80, 120); i++) { |
Copilot
AI
Jul 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
random(80, 120) returns a float, which causes the loop bound to be fractional. Use an integer cast like floor(random(80, 120))
for predictable iteration counts.
for (let i = 0; i < random(80, 120); i++) { | |
for (let i = 0; i < floor(random(80, 120)); i++) { |
Copilot uses AI. Check for mistakes.
let fireworks = []; | ||
let gravity; | ||
|
||
function setup() { | ||
createCanvas(windowWidth, windowHeight); | ||
gravity = createVector(0, 0.2); |
Copilot
AI
Jul 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Magic numbers such as gravity magnitude, drag factor (0.9), and velocity multipliers appear without context—consider extracting them into named constants to improve readability and ease tuning.
let fireworks = []; | |
let gravity; | |
function setup() { | |
createCanvas(windowWidth, windowHeight); | |
gravity = createVector(0, 0.2); | |
const GRAVITY_MAGNITUDE = 0.2; // Gravity magnitude for fireworks | |
let fireworks = []; | |
let gravity; | |
function setup() { | |
createCanvas(windowWidth, windowHeight); | |
gravity = createVector(0, GRAVITY_MAGNITUDE); |
Copilot uses AI. Check for mistakes.
fireworks.html
Outdated
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Colorful Fireworks with p5.js</title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot
<title>Colorful Fireworks with p5.js!</title>
に変更してください
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the title to "Colorful Fireworks with p5.js!" as requested. Commit: 4198718
Co-authored-by: LeoAndo <16476224+LeoAndo@users.noreply.github.com>
🎆 Colorful Fireworks Particle System
This PR adds a complete HTML file (
fireworks.html
) that creates a colorful fireworks particle system using p5.js, as requested in the issue.✨ Features Implemented
https://cdn.jsdelivr.net/npm/p5@1.11.8/lib/p5.js
🎯 Technical Implementation
The particle system includes:
Firework
class: Handles rocket launch mechanics and explosion timingParticle
class: Manages individual particle behavior with physics🖼️ Demo Screenshot
The fireworks create spectacular bursts of colorful particles that behave like real fireworks, with particles that:
🚀 Usage
Simply open
fireworks.html
in any modern web browser:Fixes #1.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
cdn.jsdelivr.net
curl -I REDACTED
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.