Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions Floating squares/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3D Floating Squares </title>
<link rel="stylesheet" href="style.css">
<style>
body {
margin: 0;
height: 100vh;
background: radial-gradient(circle at center, #0a0a0a, #000);
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
font-family: sans-serif;
}

.scene {
width: 300px;
height: 300px;
perspective: 800px;
}

.maze {
width: 100%;
height: 100%;
position: relative;
transform-style: preserve-3d;
animation: rotateMaze 15s infinite linear;
}

@keyframes rotateMaze {
from {
transform: rotateX(0deg) rotateY(0deg);
}
to {
transform: rotateX(360deg) rotateY(360deg);
}
}

.cube {
position: absolute;
width: 80px;
height: 80px;
background: linear-gradient(135deg, #00d2ff, #3a7bd5);
box-shadow: 0 0 15px #00d2ff;
transform-style: preserve-3d;
opacity: 0.85;
}

/* Position cubes in a maze pattern */
.cube:nth-child(1) { transform: translate3d(-120px, -120px, 0px); }
.cube:nth-child(2) { transform: translate3d(0px, -120px, 80px); }
.cube:nth-child(3) { transform: translate3d(120px, -120px, -80px); }
.cube:nth-child(4) { transform: translate3d(-120px, 0px, -80px); }
.cube:nth-child(5) { transform: translate3d(0px, 0px, 0px); }
.cube:nth-child(6) { transform: translate3d(120px, 0px, 80px); }
.cube:nth-child(7) { transform: translate3d(-120px, 120px, 80px); }
.cube:nth-child(8) { transform: translate3d(0px, 120px, -80px); }
.cube:nth-child(9) { transform: translate3d(120px, 120px, 0px); }

.cube::before,
.cube::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
background: inherit;
box-shadow: inherit;
}

/* Create cube illusion */
.cube::before { transform: rotateY(90deg); }
.cube::after { transform: rotateX(90deg); }

</style>
</head>
<body>
<div class="scene">
<div class="maze">
<!-- Multiple cube walls -->
<div class="cube"></div>
<div class="cube"></div>
<div class="cube"></div>
<div class="cube"></div>
<div class="cube"></div>
<div class="cube"></div>
<div class="cube"></div>
<div class="cube"></div>
<div class="cube"></div>
</div>
</div>
</body>
</html>