Make your landing page feel alive
Click any word to animate that one
The prompt
Written from your settings. Paste it into your AI tool.
Animate one word in the main headline of my landing page with an effect called Marker swipe. In my example the headline reads "Make your landing page feel alive" and the animated word is "alive". Apply it to the word I point out in my own headline, and ask me which one if I have not said. Fade the words of the headline up into place one after another, each taking 600ms with a 50ms delay between words. Then draw a highlighter mark behind that word. The mark is a rounded rectangle in my accent colour that covers the full height of the word, extends slightly past both ends and is tilted by 1.2 degrees so it feels hand drawn. If the text would be hard to read on top of the accent colour, switch that one word to a contrasting text colour as the mark passes over it. It grows from left to right by scaling on the X axis over 600ms with the easing cubic-bezier(0.65, 0, 0.35, 1), starting 550ms after the page loads. 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/marker-swipe 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 Marker swipe with your settings. It assumes the headline has the class hero-title.
<!-- HTML -->
<!-- Marker swipe animation from https://smthngfun.com/a/marker-swipe -->
<h1 class="hero-title">Make your landing page feel alive</h1>
/* CSS */
.hero-title .word { display: inline-block; }
.hero-title .word > span {
display: inline-block;
opacity: 0;
transform: translateY(0.2em);
animation: fade-up 600ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
animation-delay: calc(var(--i) * 50ms);
}
.hero-title .mark { position: relative; z-index: 0; }
.hero-title .mark::before {
content: "";
position: absolute;
inset: 0.03em -0.1em 0.07em;
z-index: -1;
border-radius: 0.12em;
background: var(--accent, #c3b3f3);
transform: scaleX(0) rotate(-1.2deg);
transform-origin: 0 50%;
animation: marker-swipe 600ms cubic-bezier(0.65, 0, 0.35, 1) 550ms forwards;
}
@keyframes fade-up { to { opacity: 1; transform: translateY(0); } }
@keyframes marker-swipe { to { transform: scaleX(1) rotate(-1.2deg); } }
@media (prefers-reduced-motion: reduce) {
.hero-title .word > span { animation: none; opacity: 1; transform: none; }
.hero-title .mark::before { animation: none; transform: rotate(-1.2deg); }
}
// JavaScript
const title = document.querySelector('.hero-title');
const text = title.textContent.trim();
title.setAttribute('aria-label', text);
title.innerHTML = text.split(/\s+/).map(function (word, i) {
return '<span class="word" aria-hidden="true"><span style="--i:' + i + '">' + word + '</span></span>';
}).join(' ');
// Word 6 of the headline, which is "alive"
title.querySelectorAll('.word')[5].classList.add('mark');