Scroll · 14 of 34
Bounce In
Content drops in and overshoots before settling, using a spring-like cubic-bezier. Good for playful UI; keep it to one or two elements per screen.
<section class="bounce-in-section">
<h2>Bounce In</h2>
</section>
.bounce-in-section {
min-height: 35vh;
display: flex;
align-items: center;
justify-content: center;
}
.bounce-in-section h2 {
font-size: 2.5rem;
color: #f0f0f5;
opacity: 0;
transform: translateY(80px) scale(0.8);
/* Overshooting cubic-bezier gives the bounce */
transition: opacity 0.5s,
transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bounce-in-section.in-view h2 {
opacity: 1;
transform: translateY(0) scale(1);
}
var section = document.querySelector('.bounce-in-section');
new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
entry.target.classList.toggle('in-view', entry.isIntersecting);
});
}, { threshold: 0.25 }).observe(section);