Scroll · 13 of 34
3D Flip
Content flips around its vertical axis into view with a perspective transform. A rotateY on a perspective parent gives real depth to a card entrance.
<section class="flip3d-section">
<h2>3D Flip</h2>
</section>
.flip3d-section {
min-height: 35vh;
display: flex;
align-items: center;
justify-content: center;
}
.flip3d-section h2 {
font-size: 2.5rem;
color: #f0f0f5;
opacity: 0;
transform: perspective(600px) rotateY(-90deg);
transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
opacity 0.5s;
}
.flip3d-section.in-view h2 {
opacity: 1;
transform: perspective(600px) rotateY(0);
}
var section = document.querySelector('.flip3d-section');
new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
entry.target.classList.toggle('in-view', entry.isIntersecting);
});
}, { threshold: 0.25 }).observe(section);