Repository navigation
Added Animation of a breathing border around the spawn Cell - #1962
Boostry123 wants to merge 1 commit into
Conversation
WalkthroughAdds a per-tick breathing border animation around the focused player in TerritoryLayer, using a new internal timer. On each tick, it computes a pulsating radius, clears the highlight canvas, and draws a circular ring at the player’s name position via a new private helper. Changes
Sequence Diagram(s)sequenceDiagram
participant GameLoop
participant TerritoryLayer
participant HighlightCanvas as Highlight Canvas Ctx
GameLoop->>TerritoryLayer: tick()
TerritoryLayer->>TerritoryLayer: increment borderAnimTime
TerritoryLayer->>TerritoryLayer: has focused player?
alt focused player present
TerritoryLayer->>TerritoryLayer: compute radius = f(sin(borderAnimTime))
TerritoryLayer->>HighlightCanvas: clear previous highlight
TerritoryLayer->>HighlightCanvas: drawBreathingRing(cx, cy, radius, color)
note right of HighlightCanvas: Pulsing ring rendered
else no focus
TerritoryLayer->>HighlightCanvas: no-op (no ring)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/client/graphics/layers/TerritoryLayer.ts (2)
26-26: Rename for clarity: this is a phase, not time.
borderAnimTimeis a tick-based phase accumulator, not wall-clock time. Rename toringPhaseto avoid confusion. References below in the animation block should update accordingly.- private borderAnimTime = 0; + private ringPhase = 0;
598-612: Isolate canvas state and add slight alpha for a softer ring.Save/restore avoids leaking stroke styles/width to other drawings. A small alpha looks better over the spawn mask.
private drawBreathingRing( cx: number, cy: number, radius: number, color: Colord, ) { const ctx = this.highlightContext; if (!ctx) return; - ctx.beginPath(); - ctx.arc(cx, cy, radius, 0, Math.PI * 2); - ctx.strokeStyle = color.toRgbString(); - ctx.lineWidth = 2; - ctx.stroke(); + ctx.save(); + ctx.beginPath(); + ctx.arc(cx, cy, radius, 0, Math.PI * 2); + ctx.strokeStyle = color.alpha(0.9).toRgbString(); + ctx.lineWidth = 2; + ctx.stroke(); + ctx.restore(); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/client/graphics/layers/TerritoryLayer.ts(3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-06-22T21:51:14.990Z
Learnt from: devalnor
PR: openfrontio/OpenFrontIO#1248
File: src/client/graphics/layers/TerritoryInfoLayer.ts:20-20
Timestamp: 2025-06-22T21:51:14.990Z
Learning: In TerritoryInfoLayer.ts, the highlightedTerritory field uses both null and undefined intentionally: undefined represents initial state or inactive layer (Ctrl released), while null represents active layer with no territory being highlighted at cursor position. This distinction is important for proper state change detection.
Applied to files:
src/client/graphics/layers/TerritoryLayer.ts
🧬 Code graph analysis (1)
src/client/graphics/layers/TerritoryLayer.ts (1)
src/core/game/GameView.ts (1)
focusedPlayer(689-692)
🔇 Additional comments (1)
src/client/graphics/layers/TerritoryLayer.ts (1)
199-227: Code around lines 180–240 requested for inspection. Once available, we’ll confirm where and how oftenhighlightContext.clearRectruns and whether the inner clear indeed wipes out spawn highlights.
scottanderson
left a comment
There was a problem hiding this comment.
Please close this PR and reopen the other one. Opening a second PR for the same issue goes against the project's policy, because it splits up the feedback.
Description:
Lost control of the previous PR (#1951) because of faulty commits , PRing again
Noticed many people are struggling to see where they choose to spawn or forget where they chose , what leads to confusion.
solved it with this animation around the spawning player cell.
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
boostry