# Beating heart loader

> A heart that beats with a real double thump, sending out a soft pulse ring with every beat.

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

## Where to use it

The double beat, one strong and one softer, is what makes this heart feel alive rather than just pulsing. Use it while a dating app looks for matches, while a charity site processes a donation or on the RSVP page of a wedding website. For a health clinic booking appointments, it is warm without being clinical.

Keep the speed close to a resting heartbeat; much faster starts to feel anxious, which is the last thing a health or donation page needs. Red and pink are the obvious picks, but a calm brand color can look more refined.

## Code

### HTML

```html
<div class="ul-ht"><b></b></div>
```

### CSS

```css
.ul-ht {
  --c1: #0071e3;
  --c2: #8ec5ff;
  --s: 72px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --bg: #f5f5f7;
}

.ul-ht {
  position: relative;
  width: var(--s);
  height: var(--s);
  display: grid;
  place-items: center;
}

.ul-ht::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--c1);
  animation: ul-ht-r calc(1.2s / var(--k)) ease-out infinite;
}

.ul-ht b {
  position: relative;
  width: 45%;
  height: 45%;
  background: var(--c1);
  transform: rotate(45deg);
  animation: ul-ht calc(1.2s / var(--k)) ease-in-out infinite;
}

.ul-ht b::before,.ul-ht b::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
}

.ul-ht b::before {
  left: -50%;
}

.ul-ht b::after {
  top: -50%;
}

@keyframes ul-ht {
  0%,40%,100% {
    transform: rotate(45deg) scale(1);
  }
  15% {
    transform: rotate(45deg) scale(1.22);
  }
  28% {
    transform: rotate(45deg) scale(1.08);
  }
}

@keyframes ul-ht-r {
  0% {
    transform: scale(.5);
    opacity: .6;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}
```

### React

```tsx
import type { CSSProperties } from "react";

const css = `
.ul-ht {
  position: relative;
  width: var(--s);
  height: var(--s);
  display: grid;
  place-items: center;
}

.ul-ht::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--c1);
  animation: ul-ht-r calc(1.2s / var(--k)) ease-out infinite;
}

.ul-ht b {
  position: relative;
  width: 45%;
  height: 45%;
  background: var(--c1);
  transform: rotate(45deg);
  animation: ul-ht calc(1.2s / var(--k)) ease-in-out infinite;
}

.ul-ht b::before,.ul-ht b::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
}

.ul-ht b::before {
  left: -50%;
}

.ul-ht b::after {
  top: -50%;
}

@keyframes ul-ht {
  0%,40%,100% {
    transform: rotate(45deg) scale(1);
  }
  15% {
    transform: rotate(45deg) scale(1.22);
  }
  28% {
    transform: rotate(45deg) scale(1.08);
  }
}

@keyframes ul-ht-r {
  0% {
    transform: scale(.5);
    opacity: .6;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}
`;

export default function LoaderHeart() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#0071e3",
          "--c2": "#8ec5ff",
          "--s": "72px",
          "--k": "1",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="ul-ht"><b></b></div>
      </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 “Beating heart loader” block (Loaders) from AIMRAN Library to my project.

## What it is
A heart that beats with a real double thump, sending out a soft pulse ring with every beat.

## Chosen settings
- Main color: #0071e3
- Secondary color: #8ec5ff
- Size: 72px (from 24 to 120px)
- Speed: 1x (from 0.5 to 2x)

## 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
import type { CSSProperties } from "react";

const css = `
.ul-ht {
  position: relative;
  width: var(--s);
  height: var(--s);
  display: grid;
  place-items: center;
}

.ul-ht::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--c1);
  animation: ul-ht-r calc(1.2s / var(--k)) ease-out infinite;
}

.ul-ht b {
  position: relative;
  width: 45%;
  height: 45%;
  background: var(--c1);
  transform: rotate(45deg);
  animation: ul-ht calc(1.2s / var(--k)) ease-in-out infinite;
}

.ul-ht b::before,.ul-ht b::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
}

.ul-ht b::before {
  left: -50%;
}

.ul-ht b::after {
  top: -50%;
}

@keyframes ul-ht {
  0%,40%,100% {
    transform: rotate(45deg) scale(1);
  }
  15% {
    transform: rotate(45deg) scale(1.22);
  }
  28% {
    transform: rotate(45deg) scale(1.08);
  }
}

@keyframes ul-ht-r {
  0% {
    transform: scale(.5);
    opacity: .6;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}
`;

export default function LoaderHeart() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#0071e3",
          "--c2": "#8ec5ff",
          "--s": "72px",
          "--k": "1",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="ul-ht"><b></b></div>
      </div>
    </>
  );
}
```

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