HTML _CSS
Light 3D Cube
HiroDaegu
2022. 10. 24. 00:45
728x90
SMALL
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GLOW EFFECT</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<section>
<div class="box">
<div class="cube">
<div class="top"></div>
<div>
<span style="--i:0;"></span>
<span style="--i:1;"></span>
<span style="--i:2;"></span>
<span style="--i:3;"></span>
</div>
</div>
</div>
</section>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: #1D0035;
min-height: 100vh;
overflow: hidden;
}
section {
position: absolute;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
transform-style: preserve-3d;
transform: perspective(700px);
}
.box {
position: absolute;
transform-style: preserve-3d;
top: 125px;
}
.box .cube {
position: relative;
width: 200px;
height: 200px;
transform-style: preserve-3d;
animation: animateCube 20s linear infinite;
}
@keyframes animateCube {
0% {
transform: rotateY(0deg);
}
100% {
transform: rotateY(360deg);
}
}
.box .cube div {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transform-style: preserve-3d;
}
.box .cube div span {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: radial-gradient(#FB6200, #FB6200, #C3300F);
transform: rotateY(calc(90deg * var(--i))) translateZ(100px);
}
.box .cube .top {
position: absolute;
top: 0;
left: 0;
width: 200px;
height: 200px;
background-color: #B22708;
transform: rotateX(90deg) translateZ(100px);
display: flex;
justify-content: center;
align-items: center;
}
.box .cube .top::before {
content: '';
position: absolute;
width: 400px;
height: 400px;
background-color: #FB6200;
transform: translateZ(-400px);
box-shadow: 0 0 120px rgba(251, 98, 0, .2),
0 0 200px rgba(251, 98, 0, .4),
0 0 300px rgba(251, 98, 0, .6),
0 0 400px rgba(251, 98, 0, .8),
0 0 500px rgba(251, 98, 0, 1);
}
728x90
LIST