A crisp double streak of light flashes diagonally across glossy letters, then rests. Unlike a soft shimmer the text stays full color, and the pause keeps it from feeling busy.
Also known as: diagonal shine text css, text shine animation, glare sweep text.
<div class="txt-glossy-shine-text">Upgrade to Pro</div>
.txt-glossy-shine-text {
--c: var(--txt-color, #3b82f6);
font-size: var(--txt-size, 32px);
font-family: system-ui, sans-serif;
font-weight: 700;
line-height: 1.2;
font-weight: 800;
background:
linear-gradient(110deg,
transparent 44%, rgb(255 255 255 / 0.9) 45%, rgb(255 255 255 / 0.9) 48.5%, transparent 49.5%,
transparent 51%, rgb(255 255 255 / 0.75) 51.8%, transparent 52.8%) 0 0 / 300% 100% no-repeat,
linear-gradient(180deg, color-mix(in srgb, var(--c) 65%, #fff) 0%, var(--c) 48%, color-mix(in srgb, var(--c) 85%, #000) 100%);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
-webkit-text-fill-color: transparent;
animation: txt-glossy-shine-text-flash 3s cubic-bezier(0.6, 0, 0.3, 1) infinite;}
@keyframes txt-glossy-shine-text-flash {
0% { background-position: 100% 0, 0 0; }
40%, 100% { background-position: 0% 0, 0 0; }
}
@media (prefers-reduced-motion: reduce) {
.txt-glossy-shine-text, .txt-glossy-shine-text *, .txt-glossy-shine-text::before, .txt-glossy-shine-text::after, .txt-glossy-shine-text *::before, .txt-glossy-shine-text *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--txt-color on the element or a parent.
Currently previewing #3b82f6.--txt-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 40px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.