-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMMM-PhotoStack.css
More file actions
85 lines (78 loc) · 2.07 KB
/
MMM-PhotoStack.css
File metadata and controls
85 lines (78 loc) · 2.07 KB
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
/* MMM-PhotoStack — polaroid-style photo stack with fly-in/fly-out animations */
.photostack-container {
position: relative;
background-color: var(--background-color, black);
width: calc(var(--photo-width) + var(--frame-width) * 2 + 80px);
height: calc(var(--photo-width) * 0.75 + var(--frame-width) * 3.5 + 80px);
perspective: 1000px;
margin: 0 auto;
}
.photostack-card {
position: absolute;
top: 50%;
left: 50%;
background: var(--frame-color);
padding: var(--frame-width);
padding-bottom: calc(var(--frame-width) * 2.5);
box-shadow:
0 8px 24px rgba(0, 0, 0, 0.4),
0 2px 6px rgba(0, 0, 0, 0.3);
transform: translate(
calc(-50% + var(--rest-x)),
calc(-50% + var(--rest-y))
)
rotate(var(--rest-rotate));
transition: transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1.05);
will-change: transform;
}
.photostack-image {
display: block;
width: var(--photo-width);
height: calc(var(--photo-width) * 0.75);
object-fit: cover;
}
/* Fly-in: card sweeps from off-screen origin into its tilted resting pose. */
@keyframes photostack-fly-in {
from {
transform: translate(
calc(-50% + var(--in-x)),
calc(-50% + var(--in-y))
)
rotate(0deg)
scale(1.1);
}
to {
transform: translate(
calc(-50% + var(--rest-x)),
calc(-50% + var(--rest-y))
)
rotate(var(--rest-rotate));
}
}
.photostack-card.photostack-fly-in {
animation: photostack-fly-in var(--fly-in-duration)
cubic-bezier(0.2, 0.8, 0.2, 1.05) both;
}
/* Fly-out: card falls down and fades when bumped from the stack. */
@keyframes photostack-fly-out {
from {
transform: translate(
calc(-50% + var(--rest-x)),
calc(-50% + var(--rest-y))
)
rotate(var(--rest-rotate));
opacity: 1;
}
to {
transform: translate(
calc(-50% + var(--rest-x)),
calc(-50% + var(--rest-y) + 200px)
)
rotate(var(--rest-rotate));
opacity: 0;
}
}
.photostack-card.photostack-fly-out {
animation: photostack-fly-out var(--fly-out-duration) ease-in both;
pointer-events: none;
}