"Unveiling the Magic: Creating Stunning 3D Cube Animation with a Play Button Using HTML, CSS, and JavaScript"

Rotating 3D Cube Animation
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Rotating 3D Cube Animation</title>
  <style>
    body, html {
      margin: 0;
      padding: 0;
      height: 100%;
    }

    .container {
      width: 100%;
      height: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      perspective: 1000px;
    }

    .cube {
      width: 100px;
      height: 100px;
      position: relative;
      transform-style: preserve-3d;
      animation: rotate 5s linear infinite;
    }

    .side {
      position: absolute;
      width: 100px;
      height: 100px;
      border: 1px solid #333;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .front { transform: translateZ(50px); background: linear-gradient(135deg, #ff8a00, #e52e71); }
    .back { transform: rotateY(180deg) translateZ(50px); background: linear-gradient(45deg, #4CAF50, #008CBA); }
    .top { transform: rotateX(-90deg) translateZ(50px); background: linear-gradient(135deg, #FFD700, #FF8C00); }
    .bottom { transform: rotateX(90deg) translateZ(50px); background: linear-gradient(135deg, #9933ff, #99ff99); }
    .left { transform: rotateY(-90deg) translateZ(50px); background: linear-gradient(135deg, #33ccff, #ff6666); }
    .right { transform: rotateY(90deg) translateZ(50px); background: linear-gradient(135deg, #ffff00, #ff6600); }

    .play-button {
      position: absolute;
      width: 50px;
      height: 50px;
      background-color: white;
      border-radius: 50%;
      border: none;
      display: flex;
      justify-content: center;
      align-items: center;
      top: 25%;
      left: 25%;
    }

    .play-button::after {
      content: "";
      width: 0;
      height: 0;
      border-top: 15px solid transparent;
      border-bottom: 15px solid transparent;
      border-left: 25px solid black;
      position: relative;
    }

    @keyframes rotate {
      0% { transform: rotateY(0); }
      100% { transform: rotateY(360deg); }
    }
  </style>
</head>
<body>
  <div class="container">
    <div class="cube">
      <div class="side back"></div>
      <div class="side top"></div>
      <div class="side bottom"></div>
      <div class="side left"></div>
      <div class="side right">
        <div class="play-button"></div>
      </div>
    </div>
  </div>

  <script>
    // No JavaScript needed for this animation
  </script>
</body>
</html>

Comments

Popular posts from this blog

Cute Lamp Login Page

All videos downloader

Header Animation | Bold Text & 3D Effect | CSS Tutorial|Cursor animation effect using html css js