CSS
语言:
CSSSCSS
确定
body {
margin: 0;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
height: 100vh;
overflow: hidden;
background: black;
}
.view {
position: relative;
height: 600px;
width: 900px;
-webkit-box-flex: 0;
-webkit-flex: 0 0 900px;
-ms-flex: 0 0 900px;
flex: 0 0 900px;
}
.axis {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-transform: rotateX(-35deg) rotateY(45deg);
transform: rotateX(-35deg) rotateY(45deg);
}
.axis,
.axis * {
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.cube {
position: absolute;
top: 50%;
left: 50%;
height: 50px;
width: 50px;
margin: -25px;
will-change: transform, visibility;
}
.cube:nth-child(3) {
-webkit-transform: scaleY(0) translateY(0%);
transform: scaleY(0) translateY(0%);
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-animation: outer 3s linear infinite;
animation: outer 3s linear infinite;
margin-top: -125px;
}
.cube:nth-child(2) {
-webkit-transform: scaleY(0);
transform: scaleY(0);
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: center 3s linear infinite alternate;
animation: center 3s linear infinite alternate;
}
.cube:nth-child(1) {
-webkit-transform: scaleY(0);
transform: scaleY(0);
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-animation: outer 3s linear infinite alternate;
animation: outer 3s linear infinite alternate;
margin-top: 75px;
}
@-webkit-keyframes outer {
0%, 5% {
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
}
50% {
-webkit-transform: scaleY(2.5);
transform: scaleY(2.5);
}
95%,
100% {
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
}
}
@keyframes outer {
0%, 5% {
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
}
50% {
-webkit-transform: scaleY(2.5);
transform: scaleY(2.5);
}
95%,
100% {
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
}
}
@-webkit-keyframes center {
0%, 5%, 50% {
-webkit-transform: scaleY(0);
transform: scaleY(0);
visibility: hidden;
}
95%,
100% {
-webkit-transform: scaleY(4);
transform: scaleY(4);
visibility: visible;
}
}
@keyframes center {
0%, 5%, 50% {
-webkit-transform: scaleY(0);
transform: scaleY(0);
visibility: hidden;
}
95%,
100% {
-webkit-transform: scaleY(4);
transform: scaleY(4);
visibility: visible;
}
}
.cube .side {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: currentColor;
}
.cube .side:nth-child(1) {
-webkit-transform: translateZ(25px);
transform: translateZ(25px);
background-image: -webkit-linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.4));
background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.4));
}
.cube .side:nth-child(2) {
-webkit-transform: rotateY(-90deg) translateZ(25px);
transform: rotateY(-90deg) translateZ(25px);
background-image: -webkit-linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7));
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7));
}
.cube .side:nth-child(3) {
-webkit-transform: rotateX(90deg) translateZ(25px);
transform: rotateX(90deg) translateZ(25px);
background-image: -webkit-linear-gradient(transparent, rgba(0, 0, 0, 0.2));
background-image: linear-gradient(transparent, rgba(0, 0, 0, 0.2));
}
.collection {
display: inline-block;
height: 100%;
width: 50px;
margin: 0 12.5px;
}
.collection:nth-child(1) {
z-index: 12;
}
.collection:nth-child(1) .cube {
-webkit-animation-delay: 0s;
animation-delay: 0s;
}
.collection:nth-child(1) .cube:nth-child(1) {
color: #9efafa;
}
.collection:nth-child(1) .cube:nth-child(2) {
color: #ccfa9e;
}
.collection:nth-child(1) .cube:nth-child(3) {
color: #fa9e9e;
}
.collection:nth-child(2) {
z-index: 11;
}
.collection:nth-child(2) .cube {
-webkit-animation-delay: -0.25s;
animation-delay: -0.25s;
}
.collection:nth-child(2) .cube:nth-child(1) {
color: #9eccfa;
}
.collection:nth-child(2) .cube:nth-child(2) {
color: #9efa9e;
}
.collection:nth-child(2) .cube:nth-child(3) {
color: #facc9e;
}
.collection:nth-child(3) {
z-index: 10;
}
.collection:nth-child(3) .cube {
-webkit-animation-delay: -0.5s;
animation-delay: -0.5s;
}
.collection:nth-child(3) .cube:nth-child(1) {
color: #9e9efa;
}
.collection:nth-child(3) .cube:nth-child(2) {
color: #9efacc;
}
.collection:nth-child(3) .cube:nth-child(3) {
color: #fafa9e;
}
.collection:nth-child(4) {
z-index: 9;
}
.collection:nth-child(4) .cube {
-webkit-animation-delay: -0.75s;
animation-delay: -0.75s;
}
.collection:nth-child(4) .cube:nth-child(1) {
color: #cc9efa;
}
.collection:nth-child(4) .cube:nth-child(2) {
color: #9efafa;
}
.collection:nth-child(4) .cube:nth-child(3) {
color: #ccfa9e;
}
.collection:nth-child(5) {
z-index: 8;
}
.collection:nth-child(5) .cube {
-webkit-animation-delay: -1s;
animation-delay: -1s;
}
.collection:nth-child(5) .cube:nth-child(1) {
color: #fa9efa;
}
.collection:nth-child(5) .cube:nth-child(2) {
color: #9eccfa;
}
.collection:nth-child(5) .cube:nth-child(3) {
color: #9efa9e;
}
.collection:nth-child(6) {
z-index: 7;
}
.collection:nth-child(6) .cube {
-webkit-animation-delay: -1.25s;
animation-delay: -1.25s;
}
.collection:nth-child(6) .cube:nth-child(1) {
color: #fa9ecc;
}
.collection:nth-child(6) .cube:nth-child(2) {
color: #9e9efa;
}
.collection:nth-child(6) .cube:nth-child(3) {
color: #9efacc;
}
.collection:nth-child(7) {
z-index: 6;
}
.collection:nth-child(7) .cube {
-webkit-animation-delay: -1.5s;
animation-delay: -1.5s;
}
.collection:nth-child(7) .cube:nth-child(1) {
color: #fa9e9e;
}
.collection:nth-child(7) .cube:nth-child(2) {
color: #cc9efa;
}
.collection:nth-child(7) .cube:nth-child(3) {
color: #9efafa;
}
.collection:nth-child(8) {
z-index: 5;
}
.collection:nth-child(8) .cube {
-webkit-animation-delay: -1.75s;
animation-delay: -1.75s;
}
.collection:nth-child(8) .cube:nth-child(1) {
color: #facc9e;
}
.collection:nth-child(8) .cube:nth-child(2) {
color: #fa9efa;
}
.collection:nth-child(8) .cube:nth-child(3) {
color: #9eccfa;
}
.collection:nth-child(9) {
z-index: 4;
}
.collection:nth-child(9) .cube {
-webkit-animation-delay: -2s;
animation-delay: -2s;
}
.collection:nth-child(9) .cube:nth-child(1) {
color: #fafa9e;
}
.collection:nth-child(9) .cube:nth-child(2) {
color: #fa9ecc;
}
.collection:nth-child(9) .cube:nth-child(3) {
color: #9e9efa;
}
.collection:nth-child(10) {
z-index: 3;
}
.collection:nth-child(10) .cube {
-webkit-animation-delay: -2.25s;
animation-delay: -2.25s;
}
.collection:nth-child(10) .cube:nth-child(1) {
color: #ccfa9e;
}
.collection:nth-child(10) .cube:nth-child(2) {
color: #fa9e9e;
}
.collection:nth-child(10) .cube:nth-child(3) {
color: #cc9efa;
}
.collection:nth-child(11) {
z-index: 2;
}
.collection:nth-child(11) .cube {
-webkit-animation-delay: -2.5s;
animation-delay: -2.5s;
}
.collection:nth-child(11) .cube:nth-child(1) {
color: #9efa9e;
}
.collection:nth-child(11) .cube:nth-child(2) {
color: #facc9e;
}
.collection:nth-child(11) .cube:nth-child(3) {
color: #fa9efa;
}
.collection:nth-child(12) {
z-index: 1;
}
.collection:nth-child(12) .cube {
-webkit-animation-delay: -2.75s;
animation-delay: -2.75s;
}
.collection:nth-child(12) .cube:nth-child(1) {
color: #9efacc;
}
.collection:nth-child(12) .cube:nth-child(2) {
color: #fafa9e;
}
.collection:nth-child(12) .cube:nth-child(3) {
color: #fa9ecc;
}