-
Notifications
You must be signed in to change notification settings - Fork 0
/
thumbnail-3d.css
64 lines (64 loc) · 2.39 KB
/
thumbnail-3d.css
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
/*Thumbnail Background*/
.thumb {
width: 400px; height: 300px; margin: 70px auto;
perspective: 1000px;
-webkit-perspective: 1000px;
}
.thumb a {
display: block; width: 100%; height: 100%;
/*double layered BG for lighting effect*/
/*disabling the translucent black bg on the main image*/
background-size: cover;
/*3d space for children*/
transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
transition: all 0.5s;
transform: rotateX(80deg); transform-origin: bottom;
-webkit-transform: rotateX(80deg); -webkit-transform-origin: bottom;
}
.thumb:hover a { transform: rotateX(0deg);-webkit-transform: rotateX(0deg); }
/*bottom surface */
.thumb a:after {
/*36px high element positioned at the bottom of the image*/
content: ''; position: absolute; left: 0; bottom: 0;
width: 100%; height: 36px;
/*inherit the main BG*/
background: inherit; background-size: cover, cover;
/*draw the BG bottom up*/
background-position: bottom;
/*rotate the surface 90deg on the bottom axis*/
transform: rotateX(90deg); transform-origin: bottom;
-webkit-transform: rotateX(90deg); -webkit-transform-origin: bottom;
}
/*label style*/
.thumb a span {
color: white; text-transform: uppercase;
position: absolute; top: 100%; left: 0; width: 100%;
font: bold 12px/36px Montserrat; text-align: center;
/*the rotation is a bit less than the bottom surface to avoid flickering*/
transform: rotateX(-89.99deg); transform-origin: top;
-webkit-transform: rotateX(-89.99deg); -webkit-transform-origin: top;
z-index: 1;
}
/*shadow*/
.thumb a:before {
content: ''; position: absolute; top: 0; left: 0;
width: 100%; height: 100%;
background: rgba(0, 0, 0, 0.5);
box-shadow: 0 0 100px 50px rgba(0, 0, 0, 0.5);
transition: all 0.5s;
/*by default the shadow will be almost flat, very transparent, scaled down with a large blur*/
opacity: 0.15;
transform: rotateX(0deg) translateZ(-60px) scale(0.75);
-webkit-transform: rotateX(0deg) translateZ(-60px) scale(0.75);
transform-origin: bottom;
-webkit-transform-origin: bottom;
}
.thumb:hover a:before {
opacity: 1;
/*blurred effect using box shadow as filter: blur is not supported in all browsers*/
box-shadow: 0 0 25px 25px rgba(0, 0, 0, 0.5);
/*pushing the shadow down and scaling it down to size*/
transform: rotateX(95deg) translateZ(-80px) scale(0.85);
-webkit-transform: rotateX(95deg) translateZ(-80px) scale(0.85);
}