blob: 50f159befb74c47b823834d019d4855f4db980f2 (
plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
.book-container{
--book-width: 176px;
--book-height: 250px;
--book-thickness: 13px;
padding-top: calc(0.3 * var(--book-width));
padding-bottom: calc(0.3 * var(--book-width));
padding-left: calc(0.3 * var(--book-width));
padding-right: calc(0.3 * var(--book-width));
display: flex;
align-items: center;
justify-content: center;
transform-style: preserve-3d;
perspective: 1000px;
}
.book {
--book-initial-x-rotation: 10deg;
--book-initial-y-rotation: 30deg;
--book-initial-z-rotation: 0deg;
--book-pages-color: white;
--book-cover: "";
}
.type1{
--book-initial-x-rotation: 10deg;
--book-initial-y-rotation: 10deg;
--book-initial-z-rotation: 0deg;
}
.type2{
--book-initial-x-rotation: -10deg;
--book-initial-y-rotation: -10deg;
--book-initial-z-rotation: 2deg;
}
.book{
position: relative;
width: var(--book-width);
height: var(--book-height);
transform: rotateX(var(--book-initial-x-rotation))
rotateY(var(--book-initial-y-rotation))
rotateZ(var(--book-initial-z-rotation));
transform-style: preserve-3d;
}
.book > ._side{
border: 1px solid darkgrey;
}
.book > ._side:nth-of-type(1){
width: var(--book-width);
height: var(--book-height);
position: absolute;
transform: translateZ(calc(var(--book-thickness) * 0.5));
background: var(--book-cover) no-repeat center right scroll;
background-size: cover;
}
.book > ._side:nth-of-type(2){
width: var(--book-width);
height: var(--book-height);
position: absolute;
background-color: white;
background: var(--book-cover) no-repeat center left scroll;
background-size: cover;
transform: rotateY(180deg) translateZ(calc(var(--book-thickness) * 0.5));
}
.book > ._side:nth-of-type(3){
background-color: var(--book-pages-color);
width: var(--book-thickness);
height: var(--book-height);
position: absolute;
transform:
translateX(var(--book-width))
rotateY(90deg)
translateZ(calc(var(--book-thickness) * -0.5));
}
.book > ._side:nth-of-type(4){
background-color: var(--book-pages-color);
height: var(--book-thickness);
width: var(--book-width);
position: absolute;
transform:
rotateX(90deg)
translateZ(calc(var(--book-thickness) * 0.5));
}
.book > ._side:nth-of-type(5){
background-color: var(--book-pages-color);
height: var(--book-thickness);
width: var(--book-width);
position: absolute;
transform:
rotateX(270deg)
translateZ(calc(var(--book-height) + var(--book-thickness) * -0.5));
}
.book > ._side:nth-of-type(6){
background: var(--book-cover) no-repeat center center scroll;
width: var(--book-thickness);
height: var(--book-height);
background-size: cover;
position: absolute;
transform:
rotateY(270deg)
translateZ(calc(var(--book-thickness) * 0.5));
}
/*ANIMATION*/
@keyframes rotate {
from {
transform: rotateX(var(--book-initial-x-rotation))
rotateY(var(--book-initial-y-rotation))
rotateZ(var(--book-initial-z-rotation));
}
to {
transform: rotateX(var(--book-initial-x-rotation))
rotateY(calc(var(--book-initial-y-rotation) + 360deg))
rotateZ(var(--book-initial-z-rotation));
}
}
.book-container:hover >.book{
animation: rotate 15s infinite linear;
transition: none;
}
.flex-around-wrap{
display: flex;
justify-content: space-around;
flex-wrap: wrap;
}
|