Animated puzzle pieces that assemble and disassemble. Perfect for loading screens, transitions, or revealing content in a playful way.
<div class="puzzle">
<div class="puzzle-piece"></div>
<div class="puzzle-piece"></div>
<div class="puzzle-piece"></div>
<div class="puzzle-piece"></div>
</div>
.puzzle {
display: grid;
grid-template-columns: repeat(2, 50px);
grid-template-rows: repeat(2, 50px);
gap: 5px;
}
.puzzle-piece {
background: linear-gradient(135deg, #667eea, #764ba2);
border-radius: 8px;
animation: puzzleFloat 3s ease-in-out infinite;
}
.puzzle-piece:nth-child(1) {
animation-delay: 0s;
}
.puzzle-piece:nth-child(2) {
animation-delay: 0.2s;
}
.puzzle-piece:nth-child(3) {
animation-delay: 0.4s;
}
.puzzle-piece:nth-child(4) {
animation-delay: 0.6s;
}
@keyframes puzzleFloat {
0%, 100% {
transform: translate(0, 0) rotate(0deg);
opacity: 1;
}
50% {
transform: translate(10px, -10px) rotate(10deg);
opacity: 0.7;
}
}