# Liquid sunset background

> Layers of waves rolling at different speeds beneath a glowing sun, as a full-screen animated background.

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

## Where to use it

Warm sky, soft sun and waves drifting past at their own pace: this liquid sunset background sets a summer mood straight away. It suits the hero of a surf school, the site of a beach bar, a summer music festival or the page of a chillwave album. It is built with pure HTML and CSS, so it stays light.

The upper half, where the sun sits, is the natural place for your headline. The last wave takes the page background color, so it blends into the next section without a hard edge. Slow the speed right down for a lazy, late-afternoon feel.

## Code

### HTML

```html
<div class="pt-sunset"><i></i><i></i><i></i><i></i></div>
```

### CSS

```css
.pt-sunset {
  --c1: #f97316;
  --c2: #f43f5e;
  --c3: #8b5cf6;
  --k: 1;
  /* velocidad */
  --d: 1;
  /* densidad / escala */
  --o: 1;
  /* opacidad */
  --bg: #05060a;
  --fg: #ffffff;
  --blend: screen;
  min-height: 100vh;
}

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

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

.pt-sunset {
  background: linear-gradient(180deg,color-mix(in srgb,var(--c3) 45%,var(--bg)),color-mix(in srgb,var(--c2) 55%,var(--bg)) 50%,var(--c1))!important;
}

.pt-sunset::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 18%;
  width: 28%;
  aspect-ratio: 1;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(circle,#fff8,var(--c1) 40%,transparent 70%);
  filter: blur(8px);
}

.pt-sunset i {
  position: absolute;
  left: 50%;
  width: 250%;
  aspect-ratio: 1;
  margin-left: -125%;
  border-radius: 43%;
  will-change: transform;
  animation: pt-sunset-r calc(22s / var(--k)) linear infinite;
}

.pt-sunset i:nth-child(1) {
  top: 44%;
  background: color-mix(in srgb,var(--c1) 70%,transparent);
}

.pt-sunset i:nth-child(2) {
  top: 54%;
  border-radius: 40%;
  background: color-mix(in srgb,var(--c2) 75%,var(--bg));
  animation-duration: calc(16s / var(--k));
  animation-direction: reverse;
}

.pt-sunset i:nth-child(3) {
  top: 65%;
  border-radius: 45%;
  background: color-mix(in srgb,var(--c3) 60%,var(--bg));
  animation-duration: calc(12s / var(--k));
}

.pt-sunset i:nth-child(4) {
  top: 78%;
  border-radius: 42%;
  background: var(--bg);
  animation-duration: calc(26s / var(--k));
  animation-direction: reverse;
}

@keyframes pt-sunset-r {
  to {
    transform: rotate(360deg);
  }
}
```

### React

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

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

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

.pt-sunset {
  background: linear-gradient(180deg,color-mix(in srgb,var(--c3) 45%,var(--bg)),color-mix(in srgb,var(--c2) 55%,var(--bg)) 50%,var(--c1))!important;
}

.pt-sunset::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 18%;
  width: 28%;
  aspect-ratio: 1;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(circle,#fff8,var(--c1) 40%,transparent 70%);
  filter: blur(8px);
}

.pt-sunset i {
  position: absolute;
  left: 50%;
  width: 250%;
  aspect-ratio: 1;
  margin-left: -125%;
  border-radius: 43%;
  will-change: transform;
  animation: pt-sunset-r calc(22s / var(--k)) linear infinite;
}

.pt-sunset i:nth-child(1) {
  top: 44%;
  background: color-mix(in srgb,var(--c1) 70%,transparent);
}

.pt-sunset i:nth-child(2) {
  top: 54%;
  border-radius: 40%;
  background: color-mix(in srgb,var(--c2) 75%,var(--bg));
  animation-duration: calc(16s / var(--k));
  animation-direction: reverse;
}

.pt-sunset i:nth-child(3) {
  top: 65%;
  border-radius: 45%;
  background: color-mix(in srgb,var(--c3) 60%,var(--bg));
  animation-duration: calc(12s / var(--k));
}

.pt-sunset i:nth-child(4) {
  top: 78%;
  border-radius: 42%;
  background: var(--bg);
  animation-duration: calc(26s / var(--k));
  animation-direction: reverse;
}

@keyframes pt-sunset-r {
  to {
    transform: rotate(360deg);
  }
}

`;

export default function PatternSunset() {
  const ref = useRef(null);
  return (
    <>
      <style>{css}</style>
      <div
        ref={ref}
        className="pt-sunset"
        style={{
          "--c1": "#f97316",
          "--c2": "#f43f5e",
          "--c3": "#8b5cf6",
          "--k": 1,
          "--d": 1,
          "--o": 1,
          "--bg": "#05060a",
          "--fg": "#ffffff",
          "--blend": "screen",
          minHeight: "100vh",
        }}
      >
        <i></i><i></i><i></i><i></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 “Liquid sunset background” block (Backgrounds) from AIMRAN Library to my project.

## What it is
Layers of waves rolling at different speeds beneath a glowing sun, as a full-screen animated background.

## Chosen settings
- Color 1: #f97316
- Color 2: #f43f5e
- Color 3: #8b5cf6
- 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-sunset {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg);
  container-type: size;
  isolation: isolate;
}

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

.pt-sunset {
  background: linear-gradient(180deg,color-mix(in srgb,var(--c3) 45%,var(--bg)),color-mix(in srgb,var(--c2) 55%,var(--bg)) 50%,var(--c1))!important;
}

.pt-sunset::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 18%;
  width: 28%;
  aspect-ratio: 1;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(circle,#fff8,var(--c1) 40%,transparent 70%);
  filter: blur(8px);
}

.pt-sunset i {
  position: absolute;
  left: 50%;
  width: 250%;
  aspect-ratio: 1;
  margin-left: -125%;
  border-radius: 43%;
  will-change: transform;
  animation: pt-sunset-r calc(22s / var(--k)) linear infinite;
}

.pt-sunset i:nth-child(1) {
  top: 44%;
  background: color-mix(in srgb,var(--c1) 70%,transparent);
}

.pt-sunset i:nth-child(2) {
  top: 54%;
  border-radius: 40%;
  background: color-mix(in srgb,var(--c2) 75%,var(--bg));
  animation-duration: calc(16s / var(--k));
  animation-direction: reverse;
}

.pt-sunset i:nth-child(3) {
  top: 65%;
  border-radius: 45%;
  background: color-mix(in srgb,var(--c3) 60%,var(--bg));
  animation-duration: calc(12s / var(--k));
}

.pt-sunset i:nth-child(4) {
  top: 78%;
  border-radius: 42%;
  background: var(--bg);
  animation-duration: calc(26s / var(--k));
  animation-direction: reverse;
}

@keyframes pt-sunset-r {
  to {
    transform: rotate(360deg);
  }
}

`;

export default function PatternSunset() {
  const ref = useRef(null);
  return (
    <>
      <style>{css}</style>
      <div
        ref={ref}
        className="pt-sunset"
        style={{
          "--c1": "#f97316",
          "--c2": "#f43f5e",
          "--c3": "#8b5cf6",
          "--k": 1,
          "--d": 1,
          "--o": 1,
          "--bg": "#05060a",
          "--fg": "#ffffff",
          "--blend": "screen",
          minHeight: "100vh",
        }}
      >
        <i></i><i></i><i></i><i></i>
      </div>
    </>
  );
}
```

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