generated from codersforcauses/django-nextjs-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Issue 47 add explosions to committee page #83
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
Open
Oliverr48
wants to merge
53
commits into
main
Choose a base branch
from
issue-47-Add_explosions_to_committee_page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
f5d6deb
added some homemade explosion assets!
samjjacko 4f2343c
Merge branch 'issue-47-Add_explosions_to_committee_page' of https://g…
Oliverr48 92f64d1
Add explosions file and sfx file and useExplosions.ts (1-22)
Oliverr48 9a3fd64
Merge branch 'issue-47-Add_explosions_to_committee_page' of https://g…
Oliverr48 f72a38b
Add state management to useExplosions hook
Oliverr48 81f85cf
Add explosion positioning logic to triggerExplosions
Oliverr48 f98b362
Add Explosion component to render explosions
Oliverr48 e8e7777
Add sound effects to useExplosions hook
Oliverr48 ea9cb19
Add ExplosionContainer component to manage explosion rendering
Oliverr48 13f81a4
Add explosion trigger button to landing page
Oliverr48 bfad652
Add click-to-explode functionality to landing page
Oliverr48 1d0e0d0
Add basic black crater circle to explosions
Oliverr48 fd6c7d2
Add crater fade animation
Oliverr48 286942d
Make crater irregular/jagged shape
Oliverr48 c7dc0c5
Add basic debris pieces
Oliverr48 ab17b57
Add debris flight animation
Oliverr48 38d0676
Increase debris size and count
Oliverr48 e1c6a92
Make debris irregular torn shapes
Oliverr48 7d4b9ef
Add DebrisBurst component structure with TypeScript types
Oliverr48 7fbba70
Add debris initialization logic to DebrisBurst
Oliverr48 a3160d5
Add requestAnimationFrame loop setup to DebrisBurst
Oliverr48 1189843
Implement basic physics (position and velocity) in DebrisBurst
Oliverr48 03bb566
Add gravity and air drag to DebrisBurst physics
Oliverr48 e97ce18
Add rotation and lifetime to DebrisBurst physics
Oliverr48 2076d88
Add rock-like styling to DebrisBurst debris chunks
Oliverr48 a6bb186
Integrate DebrisBurst into Explosion component and click handler
Oliverr48 c5bfa64
Merge branch 'main' of https://github.com/codersforcauses/game-dev in…
Oliverr48 ae08bd1
Merge main into issue-47-Add_explosions_to_committee_page
Oliverr48 7a6b8da
Add bomb click explosion and remove Press Me button
Oliverr48 69bf4e1
Add bomb click explosion and optimize performance
Oliverr48 924fcf0
feat: Add basic SVG crater with depth shading gradients
Oliverr48 d25268a
feat: Add screen shake effect on bomb click
Oliverr48 95995f9
feat: Add crater expansion animation on explosion
Oliverr48 98c4a6c
feat: Add basic crack lines extending from crater
Oliverr48 6583a2b
feat: Make cracks tapered with wide base and sharp tips
Oliverr48 bd15536
feat: Ensure cracks properly attach to crater edge
Oliverr48 153f598
fix: Make crater appear at click position
Oliverr48 ce44667
feat: Add Smoke component for explosion effects
Oliverr48 d8ec947
refactor: Restore original Crater component structure
Oliverr48 5bd76b6
feat: Add CSS animations for crater and fissures
Oliverr48 a0b4df8
perf: Wrap Explosion component with React.memo
Oliverr48 72f8ac3
feat: Add Smoke effect and update crater size
Oliverr48 59a4572
docs: Update useExplosions comments to match original style
Oliverr48 5517479
fix: Remove expanding animations and shadow from crater
Oliverr48 7b4edc6
feat: Improve crater and smoke visual effects
Oliverr48 243aacb
perf: Optimize explosion effects to reduce lag
Oliverr48 6d39a3d
Merge remote-tracking branch 'origin/main' into issue-47-Add_explosio…
Oliverr48 5050204
feat: add interactive explosion effects to landing and committee pages
Oliverr48 eb95cc9
feat: add bombs to landing and committee pages
Oliverr48 7421785
fix issue ESlint
Oliverr48 4bedc5d
- Fix prettier formatting
Oliverr48 87ef46a
refactor: Create usePageExplosions hook to extract duplicated explosi…
Oliverr48 9be6fe3
refactor: Create ExplosionEffects component for shared rendering
Oliverr48 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may need to remove this duplicate explosion gif |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| import React, { useMemo } from "react"; | ||
|
|
||
| interface CraterProps { | ||
| size?: number; | ||
| intensity?: number; | ||
| } | ||
|
|
||
| /** | ||
| * Generates an irregular crater polygon | ||
| */ | ||
| function generateCraterShape(baseRadius: number, points: number = 10): string { | ||
| const coords: string[] = []; | ||
|
|
||
| for (let i = 0; i < points; i++) { | ||
| const angle = (i / points) * Math.PI * 2; | ||
| const radius = baseRadius * (0.75 + Math.random() * 0.3); | ||
| const x = 50 + Math.cos(angle) * radius; | ||
| const y = 50 + Math.sin(angle) * radius; | ||
| coords.push(`${x.toFixed(1)},${y.toFixed(1)}`); | ||
| } | ||
|
|
||
| return coords.join(" "); | ||
| } | ||
|
|
||
| /** | ||
| * Generates a crack as a polygon shape (actual gap in ground) | ||
| * Returns points for a wedge-shaped fissure | ||
| */ | ||
| function generateCrackFissure( | ||
| angle: number, | ||
| startRadius: number, | ||
| length: number, | ||
| ): string { | ||
| // Crack is a tapered wedge shape - wide at crater, sharp point at end | ||
| const widthAtStart = 7 + Math.random() * 5; // Bit skinnier (7-12) | ||
| const widthAtEnd = 0.5 + Math.random() * 1; // Sharp point at tip (0.5-1.5) | ||
|
|
||
| // Calculate perpendicular angle for width | ||
| const perpAngle = angle + Math.PI / 2; | ||
|
|
||
| // Points along the crack with some jaggedness | ||
| const segments = 3; | ||
| const points: Array<{ x: number; y: number }> = []; | ||
| const pointsBack: Array<{ x: number; y: number }> = []; | ||
|
|
||
| let currentAngle = angle; | ||
|
|
||
| for (let i = 0; i <= segments; i++) { | ||
| const t = i / segments; | ||
| // Start from inside crater and extend outward | ||
| const radius = startRadius + length * t; | ||
| const width = widthAtStart + (widthAtEnd - widthAtStart) * t; | ||
|
|
||
| // Add jaggedness to angle | ||
| if (i > 0 && i < segments) { | ||
| currentAngle += (Math.random() - 0.5) * 0.3; | ||
| } | ||
|
|
||
| const centerX = 50 + Math.cos(currentAngle) * radius; | ||
| const centerY = 50 + Math.sin(currentAngle) * radius; | ||
|
|
||
| // Offset perpendicular for width | ||
| const offsetX = (Math.cos(perpAngle) * width) / 2; | ||
| const offsetY = (Math.sin(perpAngle) * width) / 2; | ||
|
|
||
| // Add random jaggedness to edges - less at the tip for sharp point | ||
| const jagAmount = 4 * (1 - t * 0.8); // More jagged at start, smooth at tip | ||
| const jag1 = (Math.random() - 0.5) * jagAmount; | ||
| const jag2 = (Math.random() - 0.5) * jagAmount; | ||
|
|
||
| points.push({ | ||
| x: centerX + offsetX + jag1, | ||
| y: centerY + offsetY + jag1, | ||
| }); | ||
| pointsBack.unshift({ | ||
| x: centerX - offsetX + jag2, | ||
| y: centerY - offsetY + jag2, | ||
| }); | ||
| } | ||
|
|
||
| // Combine into polygon | ||
| const allPoints = [...points, ...pointsBack]; | ||
| return allPoints.map((p) => `${p.x.toFixed(1)},${p.y.toFixed(1)}`).join(" "); | ||
| } | ||
|
|
||
| /** | ||
| * Crater with fissure-style cracks (actual gaps, not lines) | ||
| */ | ||
| export const Crater = React.memo(function Crater({ | ||
| size = 100, | ||
| intensity = 1, | ||
| }: CraterProps) { | ||
| const uniqueId = useMemo(() => Math.random().toString(36).substr(2, 9), []); | ||
|
|
||
| // Crater shapes | ||
| const outerCrater = useMemo(() => generateCraterShape(22, 12), []); | ||
| const innerCrater = useMemo(() => generateCraterShape(14, 10), []); | ||
| const deepCrater = useMemo(() => generateCraterShape(8, 8), []); | ||
|
|
||
| // Generate 2-4 crack fissures (reduced for performance) | ||
| const fissures = useMemo(() => { | ||
| const count = 2 + Math.floor(Math.random() * 3); | ||
| const result: Array<{ points: string }> = []; | ||
|
|
||
| for (let i = 0; i < count; i++) { | ||
| const baseAngle = (i / count) * Math.PI * 2; | ||
| const angle = baseAngle + (Math.random() - 0.5) * 0.8; | ||
| const length = 20 + Math.random() * 18; | ||
|
|
||
| result.push({ | ||
| points: generateCrackFissure(angle, 14, length), | ||
| }); | ||
| } | ||
|
|
||
| return result; | ||
| }, []); | ||
|
|
||
| // Colors | ||
| const voidColor = `rgba(0, 0, 0, ${intensity})`; | ||
| const deepColor = `rgba(8, 5, 2, ${0.95 * intensity})`; | ||
| const craterColor = `rgba(20, 15, 8, ${0.9 * intensity})`; | ||
| const rimColor = `rgba(45, 35, 25, ${0.7 * intensity})`; | ||
|
|
||
| return ( | ||
| <svg | ||
| width={size} | ||
| height={size} | ||
| viewBox="0 0 100 100" | ||
| style={{ overflow: "visible", contain: "layout style" }} | ||
| > | ||
| <defs> | ||
| <radialGradient | ||
| id={`crater-grad-${uniqueId}`} | ||
| cx="40%" | ||
| cy="40%" | ||
| r="60%" | ||
| > | ||
| <stop offset="0%" stopColor={voidColor} /> | ||
| <stop offset="50%" stopColor={deepColor} /> | ||
| <stop offset="80%" stopColor={craterColor} /> | ||
| <stop offset="100%" stopColor={rimColor} /> | ||
| </radialGradient> | ||
| </defs> | ||
|
|
||
| {/* Crack fissures - simplified to single polygon each */} | ||
| {fissures.map((fissure, i) => ( | ||
| <polygon key={i} points={fissure.points} fill={voidColor} /> | ||
| ))} | ||
|
|
||
| {/* Outer crater rim */} | ||
| <polygon points={outerCrater} fill={rimColor} /> | ||
|
|
||
| {/* Main crater */} | ||
| <polygon points={outerCrater} fill={`url(#crater-grad-${uniqueId})`} /> | ||
|
|
||
| {/* Inner crater layer */} | ||
| <polygon points={innerCrater} fill={deepColor} /> | ||
|
|
||
| {/* Deepest void */} | ||
| <polygon points={deepCrater} fill={voidColor} /> | ||
|
|
||
| {/* Crater rim edge */} | ||
| <polygon | ||
| points={outerCrater} | ||
| fill="none" | ||
| stroke="rgba(60, 50, 40, 0.4)" | ||
| strokeWidth="1.5" | ||
| strokeLinejoin="round" | ||
| /> | ||
| </svg> | ||
| ); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Ideally we should try to keep our dependencies constant where possible. Is there a reason we needed a more recent version of
framer-motion?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.
Looking at it now, the explosion features only use basic framer-motion APIs (motion.div, animate, transition) that have been stable for a long time. The version bump wasn't intentional - it likely happened when I ran npm install framer-motion to fix a missing dependency error from the Footer component (which was added in a different branch).
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.
All good then, just revert
package.jsonandpackage-lock.jsonback to their prior versions