How a single 'opacity: 0' pushed my home page LCP to 4.3 seconds
After adding new animations I re-ran Lighthouse and saw something unexpected: the home page was noticeably slower than the inner pages. Even more interesting, the problem wasn't in the new code but in the old one.
The numbers
Lighthouse, mobile mode, local. Each page measured 3 times:
| Page | Performance | LCP |
|---|---|---|
/ | ~75 | 4.2–4.4 s |
/about | ~93 | 2.7 s |
/blogs | ~95 | 2.2 s |
The home page has no big image and no heavy script. So why a 4-second LCP?
Which element is LCP?
The Lighthouse report has a "Largest Contentful Paint element" section. It wasn't the heading or an image, but the
Typewriter component: a small span that types and deletes job titles letter by letter.
The LCP breakdown looked like this:
- TTFB: 11%
- Render delay: 89% (3.8 s)
So the HTML arrived fast, but the browser waited 3.8 seconds before deciding "the largest element has been painted".
The cause
To make the hero block appear nicely, there was this animation:
@keyframes hero-in {
from { opacity: 0; transform: translateY(24px); }
to { opacity: 1; transform: none; }
}
Chrome doesn't treat a fully transparent (opacity: 0) element as an LCP candidate. So the heading, name and bio
were ignored when first painted. When the animation ends they aren't "painted" again, but the Typewriter creates a new
paint every time it types new text. LCP moved to exactly that moment: 1.8 seconds holding the first word, then
deleting and typing the next one.
The fix
from { opacity: .01; transform: translateY(24px); }
You can't see the difference between 0 and 0.01. For Chrome, though, the element is now visible, so the heading
becomes an LCP candidate immediately.
| Before | After | |
|---|---|---|
| Performance | ~75 | ~90 |
| LCP | 4.3 s | 3.1 s |
| LCP element | Typewriter | Bio text |
Takeaways
- If you put an entrance animation on above-the-fold content, don't start it at
opacity: 0. - In Lighthouse, look beyond the score at the LCP element and render delay.
- Components whose content changes over time (typewriters, carousels, counters) can delay LCP.
- Measure more than once: local Lighthouse varies by ±5 points between runs.