Create depth and dimension with perspective-based scrolling effects. Items appear to move at different speeds creating a parallax-like 3D experience.
<div class="perspective-container">
<div class="perspective-item">1</div>
<div class="perspective-item">2</div>
<div class="perspective-item">3</div>
</div>
.perspective-container {
perspective: 800px;
display: flex;
gap: 20px;
justify-content: center;
padding: 40px;
}
.perspective-item {
width: 80px;
height: 80px;
background: linear-gradient(135deg, #667eea, #764ba2);
display: flex;
align-items: center;
justify-content: center;
font-size: 2rem;
font-weight: 900;
color: white;
border-radius: 12px;
animation: perspectiveFloat 3s ease-in-out infinite;
}
.perspective-item:nth-child(1) {
animation-delay: 0s;
}
.perspective-item:nth-child(2) {
animation-delay: 0.3s;
}
.perspective-item:nth-child(3) {
animation-delay: 0.6s;
}
@keyframes perspectiveFloat {
0%, 100% { transform: translateZ(0px) rotateY(0deg); }
50% { transform: translateZ(100px) rotateY(15deg); }
}