|
| 1 | +import { wrapText } from '../utils'; |
| 2 | + |
| 3 | +export const cod = (ctx, width, height, scale, data) => { |
| 4 | + const { repoOwner, repoName, description, language, stars, forks } = data; |
| 5 | + // CALL OF DUTY / TACTICAL OPS Style |
| 6 | + |
| 7 | + // Background: Dark Camo / Night Vision Green tint |
| 8 | + ctx.fillStyle = '#0a0f0a'; // Very dark green/black |
| 9 | + ctx.fillRect(0, 0, width, height); |
| 10 | + |
| 11 | + // Grid Overlay (Tactical Map) |
| 12 | + ctx.strokeStyle = 'rgba(100, 255, 100, 0.1)'; |
| 13 | + ctx.lineWidth = 1 * scale; |
| 14 | + const gridSize = 50 * scale; |
| 15 | + ctx.beginPath(); |
| 16 | + for(let x=0; x<width; x+=gridSize) { |
| 17 | + ctx.moveTo(x, 0); ctx.lineTo(x, height); |
| 18 | + } |
| 19 | + for(let y=0; y<height; y+=gridSize) { |
| 20 | + ctx.moveTo(0, y); ctx.lineTo(width, y); |
| 21 | + } |
| 22 | + ctx.stroke(); |
| 23 | + |
| 24 | + const padding = 60 * scale; |
| 25 | + const primaryColor = '#7fff00'; // Radar Green |
| 26 | + const secondaryColor = '#ffffff'; |
| 27 | + |
| 28 | + // Top Left: Mission Info |
| 29 | + ctx.fillStyle = primaryColor; |
| 30 | + ctx.font = `bold ${24 * scale}px "Courier New", monospace`; |
| 31 | + ctx.fillText(`OPERATOR: ${repoOwner.toUpperCase()}`, padding, padding); |
| 32 | + ctx.fillText(`MISSION: ${repoName.toUpperCase()}`, padding, padding + 30 * scale); |
| 33 | + |
| 34 | + // Top Right: Coordinates / Time |
| 35 | + ctx.textAlign = 'right'; |
| 36 | + ctx.fillText(`LOC: ${stars || '0'}°N ${forks || '0'}°E`, width - padding, padding); |
| 37 | + ctx.fillText(`LANG: ${language.toUpperCase()}`, width - padding, padding + 30 * scale); |
| 38 | + |
| 39 | + // Center: Main Title with Glitch/Scan effect |
| 40 | + ctx.textAlign = 'center'; |
| 41 | + ctx.font = `900 ${100 * scale}px "Impact", sans-serif`; |
| 42 | + ctx.fillStyle = 'rgba(255, 255, 255, 0.1)'; |
| 43 | + ctx.fillText(repoName.toUpperCase(), width/2 + 5*scale, height/2 + 5*scale); // Shadow |
| 44 | + |
| 45 | + ctx.fillStyle = secondaryColor; |
| 46 | + ctx.fillText(repoName.toUpperCase(), width/2, height/2); |
| 47 | + |
| 48 | + // Crosshair in center |
| 49 | + ctx.strokeStyle = primaryColor; |
| 50 | + ctx.lineWidth = 2 * scale; |
| 51 | + const chSize = 40 * scale; |
| 52 | + ctx.beginPath(); |
| 53 | + ctx.moveTo(width/2 - chSize, height/2); ctx.lineTo(width/2 + chSize, height/2); |
| 54 | + ctx.moveTo(width/2, height/2 - chSize); ctx.lineTo(width/2, height/2 + chSize); |
| 55 | + ctx.stroke(); |
| 56 | + ctx.beginPath(); |
| 57 | + ctx.arc(width/2, height/2, 200 * scale, 0, Math.PI * 2); // Large circle |
| 58 | + ctx.setLineDash([10 * scale, 15 * scale]); |
| 59 | + ctx.stroke(); |
| 60 | + ctx.setLineDash([]); |
| 61 | + |
| 62 | + // Description Box (Tactical Intel) |
| 63 | + const descY = height * 0.65; |
| 64 | + ctx.fillStyle = 'rgba(0, 50, 0, 0.5)'; |
| 65 | + ctx.strokeStyle = primaryColor; |
| 66 | + ctx.lineWidth = 2 * scale; |
| 67 | + ctx.fillRect(width * 0.15, descY, width * 0.7, 120 * scale); |
| 68 | + ctx.strokeRect(width * 0.15, descY, width * 0.7, 120 * scale); |
| 69 | + |
| 70 | + ctx.fillStyle = primaryColor; |
| 71 | + ctx.font = `normal ${28 * scale}px "Courier New", monospace`; |
| 72 | + ctx.textAlign = 'center'; |
| 73 | + ctx.fillText("/// BRIEFING ///", width/2, descY - 10 * scale); |
| 74 | + |
| 75 | + ctx.fillStyle = secondaryColor; |
| 76 | + wrapText(ctx, description.toUpperCase(), width/2, descY + 40 * scale, width * 0.65, 35 * scale); |
| 77 | + |
| 78 | + // Bottom Corners: Tech Decoration |
| 79 | + ctx.fillStyle = primaryColor; |
| 80 | + ctx.fillRect(padding, height - padding, 100 * scale, 10 * scale); |
| 81 | + ctx.fillRect(padding, height - padding - 50 * scale, 10 * scale, 60 * scale); |
| 82 | + |
| 83 | + ctx.fillRect(width - padding - 100 * scale, height - padding, 100 * scale, 10 * scale); |
| 84 | + ctx.fillRect(width - padding, height - padding - 50 * scale, 10 * scale, 60 * scale); |
| 85 | +}; |
0 commit comments