Rotating Image Cube - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Rotating Image Cube</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; background: #333; margin: 0; font-family: Arial, sans-serif; perspective: 1000px; } .cube { position: relative; width: 200px; transform-style: preserve-3d; animation: rotate 10s infinite linear; } .cube img { position: absolute; width: 200px; height: 200px; object-fit: cover; border: 2px solid #fff; } .cube img:nth-child(1) { transform: rotateY(0deg) translateZ(100px); } .cube img:nth-child(2) { transform: rotateY(90deg) translateZ(100px); } .cube img:nth-child(3) { transform: rotateY(180deg) translateZ(100px); } .cube img:nth-child(4) { transform: rotateY(270deg) translateZ(100px); } .cube img:nth-child(5) { transform: rotateX(90deg) translateZ(100px); } .cube img:nth-child(6) { transform: rotateX(-90deg) translateZ(100px); } @keyframes rotate { from { transform: rotateX(0deg) rotateY(0deg); } to { transform: rotateX(360deg) rotateY(360deg); } } </style> </head> <body> <div class="cube"> <img src="https://via.placeholder.com/200" alt="Image 1"> <img src="https://via.placeholder.com/200" alt="Image 2"> <img src="https://via.placeholder.com/200" alt="Image 3"> <img src="https://via.placeholder.com/200" alt="Image 4"> <img src="https://via.placeholder.com/200" alt="Image 5"> <img src="https://via.placeholder.com/200" alt="Image 6"> </div> </body> </html>