# Shine sweep

> A band of colour glides across the letters.

- Applies to the whole headline
- Live page with controls: https://smthngfun.com/a/shine-sweep
- This style as JSON: https://smthngfun.com/api/styles/shine-sweep
- Every style: https://smthngfun.com/llms.txt

## Settings

The values below are the ones this page was asked for. Change any of them by adding it as a query parameter to the page, to this file or to the JSON address.

| Setting | Parameter | Value | Allowed |
| --- | --- | --- | --- |
| Full cycle | `cycle` | `3600` | 1200 to 9000 ms |
| Angle | `angle` | `100` | 45 to 135 deg |
| Band width | `band` | `20` | 4 to 50 % |
| Accent colour | `accent` | empty | Six digit hex without the hash. Empty means the site's own accent colour. |

- `t` The headline text to show and to use in the example code.
- `f` A Google font name for the headline, for example Playfair Display.

## Prompt

Written for a coding assistant. It describes the animation fully, so it works without the code below.

```text
Animate the main headline in the hero section of my landing page with an effect called Shine sweep. Fill the headline text with a linear gradient at 100 degrees using background-clip text. The gradient is the normal text colour everywhere except for a band of my accent colour in the middle that is 20 percent of the gradient wide. Make the background three times wider than the text and animate background-position so the band travels across the letters from left to right in about 2 seconds, then rests for about 1.6 seconds before repeating. Use ease-in-out. The text should look completely normal while the band is resting. Keep my existing font, colours and layout exactly as they are. Screen readers and search engines must still read the headline as one normal sentence, so put the full text in an aria-label on the heading and mark any decorative spans as aria-hidden. If the visitor has prefers-reduced-motion turned on, show the finished headline straight away with no animation. Make sure nothing shifts the layout while it plays. Use plain CSS and a little vanilla JavaScript, unless my project already has an animation library, in which case use that. A live demo with reference code for these exact settings is at https://smthngfun.com/a/shine-sweep and you can use that code as your starting point, adapted to my codebase and styling. If I am happy to credit the source, add a small "Animation by smthngfun" link to https://smthngfun.com in the footer of the page. Ask me before adding it.
```

## Reference code

A working version with the settings above. It assumes the headline has the class `hero-title`. Adapt it to the project's own framework and styling.

```html
<!-- Shine sweep animation from https://smthngfun.com/a/shine-sweep -->
<h1 class="hero-title">Make your landing page feel alive</h1>
```

```css
.hero-title {
  --text: #1c1c28;   /* your text colour */
  --accent: #c3b3f3; /* your accent colour */
  background: linear-gradient(100deg, var(--text) 40%, var(--accent) 50%, var(--text) 60%) 100% 0 / 300% 100% no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine-sweep 3600ms ease-in-out infinite;
}
@keyframes shine-sweep {
  0% { background-position: 100% 0; }
  55%, 100% { background-position: 0% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-title { animation: none; background: none; color: var(--text); }
}
```

## Credit

Keep the comment at the top of the code, which reads "Shine sweep animation from https://smthngfun.com/a/shine-sweep". If the person you are building for is happy to credit the source, add a small visible "Animation by smthngfun" link to https://smthngfun.com in the footer of their page. Ask them first, and do not add it without their say.
