The Purpose of Cyber Attack Threat Maps
Leading cybersecurity vendors like Fortinet, Kaspersky, and Akamai popularised the live "pew pew" cyber attack map. While real-world network intrusions are discrete packet streams routed through undersea fiber-optic backbones, visualizing attacks as intercontinental missile-like ballistic arcs provides immediate spatial awareness for security analysts and executive stakeholders.
Building a high-performance threat map in a web browser requires bridging two distinct domains: geographical coordinate geometry (spherical coordinates) and 2D canvas curve rendering.
Step 1: Translating GPS Coordinates to 2D Mercator Space
Global attack telemetries define sources and targets by Latitude and Longitude. To draw these coordinates onto a flat computer display, we project spherical coordinates (where Latitude ranges from -90° to +90° and Longitude from -180° to +180°) onto a 2D Mercator plane:
function latLngToCanvasXY(lat, lng, canvasWidth, canvasHeight) {
// Equirectangular / Standard Plate Carree projection
const x = (lng + 180) * (canvasWidth / 360);
const y = (90 - lat) * (canvasHeight / 180);
return { x, y };
}
Step 2: Drawing Great-Circle Arcs with Quadratic Bezier Curves
Straight lines between cities look static and unnatural. In aviation and geospatial mapping, the shortest path between two points on a globe is a Great-Circle route. When projected onto a flat 2D map, these paths appear as elegant curved trajectories.
In HTML5 Canvas, we approximate these curves using a Quadratic Bezier curve (ctx.quadraticCurveTo). The control point is computed by calculating the midpoint between the origin and destination, then elevating it perpendicular to the travel vector proportional to the intercontinental distance:
function computeArcControlPoint(p1, p2) {
const midX = (p1.x + p2.x) / 2;
const midY = (p1.y + p2.y) / 2;
const dist = Math.hypot(p2.x - p1.x, p2.y - p1.y);
// Lift control point upward (negative Y in canvas space)
const curveHeight = Math.min(dist * 0.45, 180);
return {
cx: midX,
cy: midY - curveHeight
};
}
Step 3: Animating Flying Attack Projectiles with Easing
A static curve indicates a connection, but an animated projectile conveys an active breach attempt. To animate a projectile traveling along a quadratic curve at progress t (where t ranges from 0.0 to 1.0), we apply the classic Bezier polynomial formula:
// Position on Quadratic Bezier at time t (0.0 to 1.0)
function getBezierXY(t, p0, cp, p1) {
const oneMinusT = 1 - t;
const x = oneMinusT * oneMinusT * p0.x + 2 * oneMinusT * t * cp.x + t * t * p1.x;
const y = oneMinusT * oneMinusT * p0.y + 2 * oneMinusT * t * cp.y + t * t * p1.y;
return { x, y };
}
Performance: Hitting 60 FPS Across 100 Cities
Rendering dozens of simultaneous arcs and hundreds of animated city nodes requires disciplined rendering loops. Key techniques include:
- Static Vector World Map Layer: The continental coastlines are rendered to an offscreen background canvas once, avoiding redundant geographic polygon drawing each frame tick.
- Arc Density Caps: Limiting simultaneous active trajectories to 60 concurrent arcs prevents GPU fillrate throttling on battery-powered laptops.
- Impact Ripple Decays: When an attack projectile reaches its destination city, a radial pulse ring expands and fades using mathematical alpha decay.
Equal Earth Projection & Client-Side Canvas 2D Bloom Pipeline
Authoritative References & Technical Sources
Launch Cyber Attack Threat Map
Experience our full-screen global threat map with 100 worldwide cities, live telemetry, and authentic attack trajectories.
Launch Simulator →