# Radar sweep

> A rotating sweep over a circular grid, with blips that light up as the beam passes them.

- Category: [Backgrounds](https://library.aimran.es/components/patterns)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/pt-radar
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

The radar is great for anything about searching, tracking or scanning: the loading screen of a job search app, a security company’s hero, a delivery tracker or the landing page of a location-based game. The blips flare when the beam reaches them and fade out slowly, just like the real thing. An animated radar background in CSS.

Center your key message inside the rings rather than on top of the busiest part of the sweep. Classic green feels military or retro; switch it to your brand color and it suddenly looks a lot more like a product.

## Code

### HTML

```html
<div class="pt-radar"><b></b><i></i><i style="left:calc(50% + 0.0cqmin);top:calc(50% + -16.4cqmin);--a:0.000"></i><i style="left:calc(50% + -5.8cqmin);top:calc(50% + 15.1cqmin);--a:0.558"></i><i style="left:calc(50% + 9.0cqmin);top:calc(50% + 3.1cqmin);--a:0.302"></i><i style="left:calc(50% + -10.5cqmin);top:calc(50% + 17.2cqmin);--a:0.587"></i><i style="left:calc(50% + 17.4cqmin);top:calc(50% + 14.6cqmin);--a:0.361"></i><i style="left:calc(50% + 15.6cqmin);top:calc(50% + -23.8cqmin);--a:0.093"></i><i style="left:calc(50% + -38.7cqmin);top:calc(50% + 11.8cqmin);--a:0.703"></i><i style="left:calc(50% + -4.7cqmin);top:calc(50% + -11.9cqmin);--a:0.940"></i><i style="left:calc(50% + -12.1cqmin);top:calc(50% + -19.9cqmin);--a:0.913"></i><i style="left:calc(50% + 17.0cqmin);top:calc(50% + -27.5cqmin);--a:0.088"></i><i style="left:calc(50% + -8.5cqmin);top:calc(50% + -34.8cqmin);--a:0.962"></i><i style="left:calc(50% + 8.8cqmin);top:calc(50% + 11.2cqmin);--a:0.394"></i><i style="left:calc(50% + -10.6cqmin);top:calc(50% + 42.0cqmin);--a:0.539"></i><i style="left:calc(50% + 15.3cqmin);top:calc(50% + -39.9cqmin);--a:0.058"></i></div>
```

### CSS

```css
.pt-radar {
  --c1: #34d399;
  --c2: #6ee7b7;
  --c3: #ecfdf5;
  --k: 1;
  /* velocidad */
  --d: 1;
  /* densidad / escala */
  --o: 1;
  /* opacidad */
  --bg: #05060a;
  --fg: #ffffff;
  --blend: screen;
  min-height: 100vh;
}

.pt-radar {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg);
  container-type: size;
  isolation: isolate;
}

.pt-radar>* {
  opacity: var(--o);
}

.pt-radar {
  background: radial-gradient(circle,color-mix(in srgb,var(--c1) 14%,var(--bg)),var(--bg) 75%)!important;
}

.pt-radar b {
  position: absolute;
  inset: 0;
  background: repeating-radial-gradient(circle at 50% 50%,transparent 0 calc(12cqmin * var(--d) - 1px),color-mix(in srgb,var(--c1) 40%,transparent) calc(12cqmin * var(--d) - 1px) calc(12cqmin * var(--d))),linear-gradient(90deg,transparent calc(50% - .5px),color-mix(in srgb,var(--c1) 40%,transparent) 0 calc(50% + .5px),transparent 0),linear-gradient(0deg,transparent calc(50% - .5px),color-mix(in srgb,var(--c1) 40%,transparent) 0 calc(50% + .5px),transparent 0),linear-gradient(color-mix(in srgb,var(--c1) 8%,transparent) 1px,transparent 1px) 0 0/40px 40px,linear-gradient(90deg,color-mix(in srgb,var(--c1) 8%,transparent) 1px,transparent 1px) 0 0/40px 40px;
}

.pt-radar i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150cqmax;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: conic-gradient(from 0deg,transparent 0 290deg,color-mix(in srgb,var(--c1) 12%,transparent) 320deg,color-mix(in srgb,var(--c2) 60%,transparent) 359deg,var(--c3) 360deg);
  animation: pt-radar-r calc(4s / var(--k)) linear infinite;
}

.pt-radar i~i {
  width: 10px;
  height: 10px;
  aspect-ratio: auto;
  border-radius: 50%;
  background: var(--c3);
  box-shadow: 0 0 12px 3px var(--c2);
  opacity: 0;
  animation: pt-radar-b calc(4s / var(--k)) ease-out infinite;
  animation-delay: calc(var(--a) * 4s / var(--k));
}

@keyframes pt-radar-r {
  to {
    rotate: 360deg;
  }
}

@keyframes pt-radar-b {
  0% {
    opacity: var(--o);
    transform: scale(1.5);
  }
  40% {
    opacity: calc(var(--o) * .35);
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(.8);
  }
}
```

### React

```tsx
// @ts-nocheck
import { useEffect, useRef } from "react";

const css = `
.pt-radar {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg);
  container-type: size;
  isolation: isolate;
}

.pt-radar>* {
  opacity: var(--o);
}

.pt-radar {
  background: radial-gradient(circle,color-mix(in srgb,var(--c1) 14%,var(--bg)),var(--bg) 75%)!important;
}

.pt-radar b {
  position: absolute;
  inset: 0;
  background: repeating-radial-gradient(circle at 50% 50%,transparent 0 calc(12cqmin * var(--d) - 1px),color-mix(in srgb,var(--c1) 40%,transparent) calc(12cqmin * var(--d) - 1px) calc(12cqmin * var(--d))),linear-gradient(90deg,transparent calc(50% - .5px),color-mix(in srgb,var(--c1) 40%,transparent) 0 calc(50% + .5px),transparent 0),linear-gradient(0deg,transparent calc(50% - .5px),color-mix(in srgb,var(--c1) 40%,transparent) 0 calc(50% + .5px),transparent 0),linear-gradient(color-mix(in srgb,var(--c1) 8%,transparent) 1px,transparent 1px) 0 0/40px 40px,linear-gradient(90deg,color-mix(in srgb,var(--c1) 8%,transparent) 1px,transparent 1px) 0 0/40px 40px;
}

.pt-radar i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150cqmax;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: conic-gradient(from 0deg,transparent 0 290deg,color-mix(in srgb,var(--c1) 12%,transparent) 320deg,color-mix(in srgb,var(--c2) 60%,transparent) 359deg,var(--c3) 360deg);
  animation: pt-radar-r calc(4s / var(--k)) linear infinite;
}

.pt-radar i~i {
  width: 10px;
  height: 10px;
  aspect-ratio: auto;
  border-radius: 50%;
  background: var(--c3);
  box-shadow: 0 0 12px 3px var(--c2);
  opacity: 0;
  animation: pt-radar-b calc(4s / var(--k)) ease-out infinite;
  animation-delay: calc(var(--a) * 4s / var(--k));
}

@keyframes pt-radar-r {
  to {
    rotate: 360deg;
  }
}

@keyframes pt-radar-b {
  0% {
    opacity: var(--o);
    transform: scale(1.5);
  }
  40% {
    opacity: calc(var(--o) * .35);
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(.8);
  }
}

`;

export default function PatternRadar() {
  const ref = useRef(null);
  return (
    <>
      <style>{css}</style>
      <div
        ref={ref}
        className="pt-radar"
        style={{
          "--c1": "#34d399",
          "--c2": "#6ee7b7",
          "--c3": "#ecfdf5",
          "--k": 1,
          "--d": 1,
          "--o": 1,
          "--bg": "#05060a",
          "--fg": "#ffffff",
          "--blend": "screen",
          minHeight: "100vh",
        }}
      >
        <b></b><i></i><i style={{ left: "calc(50% + 0.0cqmin)", top: "calc(50% + -16.4cqmin)", "--a": "0.000" } as CSSProperties}></i><i style={{ left: "calc(50% + -5.8cqmin)", top: "calc(50% + 15.1cqmin)", "--a": "0.558" } as CSSProperties}></i><i style={{ left: "calc(50% + 9.0cqmin)", top: "calc(50% + 3.1cqmin)", "--a": "0.302" } as CSSProperties}></i><i style={{ left: "calc(50% + -10.5cqmin)", top: "calc(50% + 17.2cqmin)", "--a": "0.587" } as CSSProperties}></i><i style={{ left: "calc(50% + 17.4cqmin)", top: "calc(50% + 14.6cqmin)", "--a": "0.361" } as CSSProperties}></i><i style={{ left: "calc(50% + 15.6cqmin)", top: "calc(50% + -23.8cqmin)", "--a": "0.093" } as CSSProperties}></i><i style={{ left: "calc(50% + -38.7cqmin)", top: "calc(50% + 11.8cqmin)", "--a": "0.703" } as CSSProperties}></i><i style={{ left: "calc(50% + -4.7cqmin)", top: "calc(50% + -11.9cqmin)", "--a": "0.940" } as CSSProperties}></i><i style={{ left: "calc(50% + -12.1cqmin)", top: "calc(50% + -19.9cqmin)", "--a": "0.913" } as CSSProperties}></i><i style={{ left: "calc(50% + 17.0cqmin)", top: "calc(50% + -27.5cqmin)", "--a": "0.088" } as CSSProperties}></i><i style={{ left: "calc(50% + -8.5cqmin)", top: "calc(50% + -34.8cqmin)", "--a": "0.962" } as CSSProperties}></i><i style={{ left: "calc(50% + 8.8cqmin)", top: "calc(50% + 11.2cqmin)", "--a": "0.394" } as CSSProperties}></i><i style={{ left: "calc(50% + -10.6cqmin)", top: "calc(50% + 42.0cqmin)", "--a": "0.539" } as CSSProperties}></i><i style={{ left: "calc(50% + 15.3cqmin)", top: "calc(50% + -39.9cqmin)", "--a": "0.058" } as CSSProperties}></i>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Radar sweep” block (Backgrounds) from AIMRAN Library to my project.

## What it is
A rotating sweep over a circular grid, with blips that light up as the beam passes them.

## Chosen settings
- Color 1: #34d399
- Color 2: #6ee7b7
- Color 3: #ecfdf5
- Speed: 1x (from 0.2 to 3x)
- Density / scale: 1x (from 0.5 to 2x)
- Opacity: 1 (from 0.2 to 1)

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
// @ts-nocheck
import { useEffect, useRef } from "react";

const css = `
.pt-radar {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg);
  container-type: size;
  isolation: isolate;
}

.pt-radar>* {
  opacity: var(--o);
}

.pt-radar {
  background: radial-gradient(circle,color-mix(in srgb,var(--c1) 14%,var(--bg)),var(--bg) 75%)!important;
}

.pt-radar b {
  position: absolute;
  inset: 0;
  background: repeating-radial-gradient(circle at 50% 50%,transparent 0 calc(12cqmin * var(--d) - 1px),color-mix(in srgb,var(--c1) 40%,transparent) calc(12cqmin * var(--d) - 1px) calc(12cqmin * var(--d))),linear-gradient(90deg,transparent calc(50% - .5px),color-mix(in srgb,var(--c1) 40%,transparent) 0 calc(50% + .5px),transparent 0),linear-gradient(0deg,transparent calc(50% - .5px),color-mix(in srgb,var(--c1) 40%,transparent) 0 calc(50% + .5px),transparent 0),linear-gradient(color-mix(in srgb,var(--c1) 8%,transparent) 1px,transparent 1px) 0 0/40px 40px,linear-gradient(90deg,color-mix(in srgb,var(--c1) 8%,transparent) 1px,transparent 1px) 0 0/40px 40px;
}

.pt-radar i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150cqmax;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: conic-gradient(from 0deg,transparent 0 290deg,color-mix(in srgb,var(--c1) 12%,transparent) 320deg,color-mix(in srgb,var(--c2) 60%,transparent) 359deg,var(--c3) 360deg);
  animation: pt-radar-r calc(4s / var(--k)) linear infinite;
}

.pt-radar i~i {
  width: 10px;
  height: 10px;
  aspect-ratio: auto;
  border-radius: 50%;
  background: var(--c3);
  box-shadow: 0 0 12px 3px var(--c2);
  opacity: 0;
  animation: pt-radar-b calc(4s / var(--k)) ease-out infinite;
  animation-delay: calc(var(--a) * 4s / var(--k));
}

@keyframes pt-radar-r {
  to {
    rotate: 360deg;
  }
}

@keyframes pt-radar-b {
  0% {
    opacity: var(--o);
    transform: scale(1.5);
  }
  40% {
    opacity: calc(var(--o) * .35);
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(.8);
  }
}

`;

export default function PatternRadar() {
  const ref = useRef(null);
  return (
    <>
      <style>{css}</style>
      <div
        ref={ref}
        className="pt-radar"
        style={{
          "--c1": "#34d399",
          "--c2": "#6ee7b7",
          "--c3": "#ecfdf5",
          "--k": 1,
          "--d": 1,
          "--o": 1,
          "--bg": "#05060a",
          "--fg": "#ffffff",
          "--blend": "screen",
          minHeight: "100vh",
        }}
      >
        <b></b><i></i><i style={{ left: "calc(50% + 0.0cqmin)", top: "calc(50% + -16.4cqmin)", "--a": "0.000" } as CSSProperties}></i><i style={{ left: "calc(50% + -5.8cqmin)", top: "calc(50% + 15.1cqmin)", "--a": "0.558" } as CSSProperties}></i><i style={{ left: "calc(50% + 9.0cqmin)", top: "calc(50% + 3.1cqmin)", "--a": "0.302" } as CSSProperties}></i><i style={{ left: "calc(50% + -10.5cqmin)", top: "calc(50% + 17.2cqmin)", "--a": "0.587" } as CSSProperties}></i><i style={{ left: "calc(50% + 17.4cqmin)", top: "calc(50% + 14.6cqmin)", "--a": "0.361" } as CSSProperties}></i><i style={{ left: "calc(50% + 15.6cqmin)", top: "calc(50% + -23.8cqmin)", "--a": "0.093" } as CSSProperties}></i><i style={{ left: "calc(50% + -38.7cqmin)", top: "calc(50% + 11.8cqmin)", "--a": "0.703" } as CSSProperties}></i><i style={{ left: "calc(50% + -4.7cqmin)", top: "calc(50% + -11.9cqmin)", "--a": "0.940" } as CSSProperties}></i><i style={{ left: "calc(50% + -12.1cqmin)", top: "calc(50% + -19.9cqmin)", "--a": "0.913" } as CSSProperties}></i><i style={{ left: "calc(50% + 17.0cqmin)", top: "calc(50% + -27.5cqmin)", "--a": "0.088" } as CSSProperties}></i><i style={{ left: "calc(50% + -8.5cqmin)", top: "calc(50% + -34.8cqmin)", "--a": "0.962" } as CSSProperties}></i><i style={{ left: "calc(50% + 8.8cqmin)", top: "calc(50% + 11.2cqmin)", "--a": "0.394" } as CSSProperties}></i><i style={{ left: "calc(50% + -10.6cqmin)", top: "calc(50% + 42.0cqmin)", "--a": "0.539" } as CSSProperties}></i><i style={{ left: "calc(50% + 15.3cqmin)", top: "calc(50% + -39.9cqmin)", "--a": "0.058" } as CSSProperties}></i>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
