|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | +<meta charset="UTF-8"> |
| 5 | +<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | +<title>3D Pyramid</title> |
| 7 | +<style> |
| 8 | + body { |
| 9 | + margin: 0; |
| 10 | + height: 100vh; |
| 11 | + display: flex; |
| 12 | + justify-content: center; |
| 13 | + align-items: center; |
| 14 | + background: radial-gradient(circle at center, #0b132b, #1c2541); |
| 15 | + perspective: 800px; |
| 16 | + } |
| 17 | + |
| 18 | + .pyramid { |
| 19 | + position: relative; |
| 20 | + width: 200px; |
| 21 | + height: 200px; |
| 22 | + transform-style: preserve-3d; |
| 23 | + transform: rotateX(-20deg) rotateY(30deg); |
| 24 | + animation: spin 10s linear infinite; |
| 25 | + } |
| 26 | + |
| 27 | + .pyramid-face { |
| 28 | + position: absolute; |
| 29 | + width: 0; |
| 30 | + height: 0; |
| 31 | + border-left: 100px solid transparent; |
| 32 | + border-right: 100px solid transparent; |
| 33 | + border-bottom: 173.2px solid gold; |
| 34 | + transform-origin: bottom center; |
| 35 | + opacity: 0.95; |
| 36 | + } |
| 37 | + |
| 38 | + /* Properly aligned faces */ |
| 39 | + .front { |
| 40 | + transform: rotateY(0deg) translateZ(95px) rotateX(30deg); |
| 41 | + } |
| 42 | + |
| 43 | + .right { |
| 44 | + transform: rotateY(90deg) translateZ(95px) rotateX(30deg); |
| 45 | + } |
| 46 | + |
| 47 | + .back { |
| 48 | + transform: rotateY(180deg) translateZ(95px) rotateX(30deg); |
| 49 | + } |
| 50 | + |
| 51 | + .left { |
| 52 | + transform: rotateY(-90deg) translateZ(95px) rotateX(30deg); |
| 53 | + } |
| 54 | + |
| 55 | + /* Base (square) */ |
| 56 | + .base { |
| 57 | + position: absolute; |
| 58 | + width: 200px; |
| 59 | + height: 200px; |
| 60 | + background: rgba(218, 165, 32, 0.8); |
| 61 | + transform: rotateX(90deg) translateZ(-75px); |
| 62 | + } |
| 63 | + |
| 64 | + @keyframes spin { |
| 65 | + from { transform: rotateX(-20deg) rotateY(0deg); } |
| 66 | + to { transform: rotateX(-20deg) rotateY(360deg); } |
| 67 | + } |
| 68 | +</style> |
| 69 | +</head> |
| 70 | +<body> |
| 71 | + <div class="pyramid"> |
| 72 | + <div class="pyramid-face front"></div> |
| 73 | + <div class="pyramid-face right"></div> |
| 74 | + <div class="pyramid-face back"></div> |
| 75 | + <div class="pyramid-face left"></div> |
| 76 | + <div class="base"></div> |
| 77 | + </div> |
| 78 | +</body> |
| 79 | +</html> |
0 commit comments