Make your landing page feel alive
Click the headline to replay
The prompt
Written from your settings. Paste it into your AI tool.
Animate the main headline in the hero section of my landing page with an effect called Rainbow wave. Split the headline into individual letters, keeping each word in its own no-wrap span. Loop a wave through the letters forever. Each letter lifts by 0.16em and comes back down during the first 40 percent of a 1.8 seconds cycle, then rests for the remainder. Offset each letter by 60ms so the lift travels from left to right. Use ease-in-out. The motion should be playful but still comfortable to read. Colour the letters in turn with #ff5f6d, #ff9f43, #ffd93d, #6bcb77, #4d96ff and #9b5de5, repeating the sequence from the first letter to the last. Keep my existing font, other 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/rainbow-wave 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 of Rainbow wave with your settings. It assumes the headline has the class hero-title.
<!-- HTML -->
<!-- Rainbow wave animation from https://smthngfun.com/a/rainbow-wave -->
<h1 class="hero-title">Make your landing page feel alive</h1>
/* CSS */
.hero-title .word { display: inline-block; white-space: nowrap; }
.hero-title .char { display: inline-block; }
.hero-title .char {
animation: wave 1800ms ease-in-out infinite;
animation-delay: calc(var(--i) * 60ms);
}
@keyframes wave {
0%, 40%, 100% { transform: translateY(0); }
20% { transform: translateY(-0.16em); }
}
@media (prefers-reduced-motion: reduce) {
.hero-title .char { animation: none; }
}
// JavaScript
const title = document.querySelector('.hero-title');
const text = title.textContent.trim();
title.setAttribute('aria-label', text);
let n = 0;
title.innerHTML = text.split(/\s+/).map(function (word) {
const chars = Array.from(word).map(function (ch) {
return '<span class="char" style="--i:' + (n++) + '">' + ch + '</span>';
}).join('');
return '<span class="word" aria-hidden="true">' + chars + '</span>';
}).join(' ');
const palette = ['#ff5f6d', '#ff9f43', '#ffd93d', '#6bcb77', '#4d96ff', '#9b5de5'];
Array.from(title.querySelectorAll('.char')).forEach(function (letter, i) {
letter.style.color = palette[i % palette.length];
});