Skip to content

Commit 5147177

Browse files
authored
Merge pull request #992 from vaishnavi-parodkar/Added-Floating-Square
Add Floating Square
2 parents 5a76cf6 + f0abaeb commit 5147177

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

Floating squares/index.html

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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 Floating Squares </title>
7+
<link rel="stylesheet" href="style.css">
8+
<style>
9+
body {
10+
margin: 0;
11+
height: 100vh;
12+
background: radial-gradient(circle at center, #0a0a0a, #000);
13+
display: flex;
14+
align-items: center;
15+
justify-content: center;
16+
overflow: hidden;
17+
font-family: sans-serif;
18+
}
19+
20+
.scene {
21+
width: 300px;
22+
height: 300px;
23+
perspective: 800px;
24+
}
25+
26+
.maze {
27+
width: 100%;
28+
height: 100%;
29+
position: relative;
30+
transform-style: preserve-3d;
31+
animation: rotateMaze 15s infinite linear;
32+
}
33+
34+
@keyframes rotateMaze {
35+
from {
36+
transform: rotateX(0deg) rotateY(0deg);
37+
}
38+
to {
39+
transform: rotateX(360deg) rotateY(360deg);
40+
}
41+
}
42+
43+
.cube {
44+
position: absolute;
45+
width: 80px;
46+
height: 80px;
47+
background: linear-gradient(135deg, #00d2ff, #3a7bd5);
48+
box-shadow: 0 0 15px #00d2ff;
49+
transform-style: preserve-3d;
50+
opacity: 0.85;
51+
}
52+
53+
/* Position cubes in a maze pattern */
54+
.cube:nth-child(1) { transform: translate3d(-120px, -120px, 0px); }
55+
.cube:nth-child(2) { transform: translate3d(0px, -120px, 80px); }
56+
.cube:nth-child(3) { transform: translate3d(120px, -120px, -80px); }
57+
.cube:nth-child(4) { transform: translate3d(-120px, 0px, -80px); }
58+
.cube:nth-child(5) { transform: translate3d(0px, 0px, 0px); }
59+
.cube:nth-child(6) { transform: translate3d(120px, 0px, 80px); }
60+
.cube:nth-child(7) { transform: translate3d(-120px, 120px, 80px); }
61+
.cube:nth-child(8) { transform: translate3d(0px, 120px, -80px); }
62+
.cube:nth-child(9) { transform: translate3d(120px, 120px, 0px); }
63+
64+
.cube::before,
65+
.cube::after {
66+
content: '';
67+
position: absolute;
68+
width: 100%;
69+
height: 100%;
70+
background: inherit;
71+
box-shadow: inherit;
72+
}
73+
74+
/* Create cube illusion */
75+
.cube::before { transform: rotateY(90deg); }
76+
.cube::after { transform: rotateX(90deg); }
77+
78+
</style>
79+
</head>
80+
<body>
81+
<div class="scene">
82+
<div class="maze">
83+
<!-- Multiple cube walls -->
84+
<div class="cube"></div>
85+
<div class="cube"></div>
86+
<div class="cube"></div>
87+
<div class="cube"></div>
88+
<div class="cube"></div>
89+
<div class="cube"></div>
90+
<div class="cube"></div>
91+
<div class="cube"></div>
92+
<div class="cube"></div>
93+
</div>
94+
</div>
95+
</body>
96+
</html>

0 commit comments

Comments
 (0)