Scroll · 28 of 34
Circle Expand
A circle grows from the centre to fill its container as it enters view, revealing the label. A single scale transform on a rounded element.
<section class="circle-expand-section">
<div class="circle-expand">
<span>Circle Expand</span>
</div>
</section>
.circle-expand-section {
min-height: 35vh;
display: flex;
align-items: center;
justify-content: center;
}
.circle-expand {
width: 200px;
height: 200px;
background: #7c5cff;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
transform: scale(0);
/* Overshooting cubic-bezier gives a springy pop */
transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.circle-expand-section.in-view .circle-expand {
transform: scale(1);
}
var section = document.querySelector('.circle-expand-section');
new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
entry.target.classList.toggle('in-view', entry.isIntersecting);
});
}, { threshold: 0.25 }).observe(section);