123.cube-container {4 width: 200px;5 height: 200px;6 perspective: 800px;7 margin: 50px auto;8}9.cube {10 position: relative;11 width: 100%;12 height: 100%;13 transform-style: preserve-3d;14 animation: rotate 8s infinite linear;15}16.face {17 position: absolute;18 width: 200px;19 height: 200px;20 color: rgb(214, 21, 21);21 font-size: 18px;22 text-align: center;23 line-height: 200px;24 background: transparent;25 opacity: 0.9;26 border: 2px solid;27 border-image: linear-gradient(to right, #ff6b6b, #355c7d, #557d35, #cfcf16, #a51f1f) 1;28 box-shadow: 0 0 100px rgba(245, 8, 8, 0.8);29}30.front {31 transform: translateZ(100px);32}33.back {34 transform: rotateY(180deg) translateZ(100px);35}36.right {37 transform: rotateY(90deg) translateZ(100px);38}39.left {40 transform: rotateY(-90deg) translateZ(100px);41}42.top {43 transform: rotateX(90deg) translateZ(100px);44}45.bottom {46 transform: rotateX(-90deg) translateZ(100px);47}48.cube-container:hover .cube {49 animation-play-state: paused;50}51@keyframes rotate {52 0% {53 transform: rotateX(0) rotateY(0) rotateZ(0);54 }55 100% {56 transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);57 }58}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.cube-container {
width: 200px;
height: 200px;
perspective: 800px;
margin: 50px auto;
}
.cube {
position: relative;
width: 100%;
height: 100%;
transform-style: preserve-3d;
animation: rotate 8s infinite linear;
}
.face {
position: absolute;
width: 200px;
height: 200px;
color: rgb(214, 21, 21);
font-size: 18px;
text-align: center;
line-height: 200px;
background: transparent;
opacity: 0.9;
border: 2px solid;
border-image: linear-gradient(to right, #ff6b6b, #355c7d, #557d35, #cfcf16, #a51f1f) 1;
box-shadow: 0 0 100px rgba(245, 8, 8, 0.8);
}
.front {
transform: translateZ(100px);
}
.back {
transform: rotateY(180deg) translateZ(100px);
}
.right {
transform: rotateY(90deg) translateZ(100px);
}
.left {
transform: rotateY(-90deg) translateZ(100px);
}
.top {
transform: rotateX(90deg) translateZ(100px);
}
.bottom {
transform: rotateX(-90deg) translateZ(100px);
}
.cube-container:hover .cube {
animation-play-state: paused;
}
@keyframes rotate {
0% {
transform: rotateX(0) rotateY(0) rotateZ(0);
}
100% {
transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);
}
}
You need to sign in before you can write a comment.