forked from FBalint/button
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstyles.css
More file actions
136 lines (116 loc) · 3 KB
/
styles.css
File metadata and controls
136 lines (116 loc) · 3 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
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
.frame {
/* key dimensions */
--dimension: 200px;
/* Movement distances */
--hover-travel: 3px;
--press-travel: calc(var(--dimension) / 10);
/* Color customization */
--color: black;
--brightness: 1;
--blend-mode: color;
/* Transition settings */
--transition-duration: 0.4s;
--transition-easing: linear(0, 0.008 1.1%, 0.031 2.2%, 0.129 4.8%, 0.257 7.2%, 0.671 14.2%, 0.789 16.5%, 0.881 18.6%, 0.957 20.7%, 1.019 22.9%, 1.063 25.1%, 1.094 27.4%, 1.114 30.7%, 1.112 34.5%, 1.018 49.9%, 0.99 59.1%, 1);
/* Start animation settings */
--fade-duration: .3s;
--fade-delay: .3s;
--start-scale: .8;
/* Style */
position: relative;
width: var(--dimension);
height: var(--dimension);
cursor: pointer;
container-type: inline-size;
touch-action: manipulation;
overflow: hidden;
/* Start invisible and scaled down, then fade in and zoom in */
opacity: 0;
transform: scale(var(--start-scale));
animation: frameStartAnimation var(--fade-duration) ease-out var(--fade-delay) forwards;
}
.frame:focus-visible {
outline: none;
}
.frame,
.frame .frame__key,
.frame .frame__text
{
-webkit-user-select: none; /* ios Safari */
user-select: none;
}
.frame img {
/* Disable image dragging on MacOS Safari */
-webkit-user-drag: none;
}
.frame .frame__base {
width: 100%; height: 100%;
}
.frame .frame__key {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
filter: brightness(var(--brightness));
-webkit-appearance: none;
transition-property: all;
transition-duration: var(--transition-duration);
transition-timing-function: var(--transition-easing);
}
.frame .frame__cover {
position: absolute;
top: 0;
left: 0;
width: 100%; height: 100%;
}
.frame:hover .frame__key,
.frame:hover .frame__text
{
margin-top: var(--hover-travel);
}
.frame:active .frame__key,
.frame:active .frame__text,
/* :active to support Android browsers, we use JS and __active */
.frame.__active .frame__key,
.frame.__active .frame__text
{
margin-top: var(--press-travel);
}
.frame .frame__text {
font-family: sans-serif;
color: white;
white-space: nowrap;
position: absolute;
width: 100%;
height: 100%;
top: 50%;
left: 50%;
text-align: center;
align-content: center;
translate: -50% -50%;
transform: rotateY(0deg) rotateX(52.3deg) rotateZ(29deg) translateY(-28%) translateX(-16%);
margin: 0;
padding: 0;
transition-property: all;
transition-timing-function: var(--transition-easing);
transition-duration: var(--transition-duration);
}
.frame .frame__text {
font-size: calc(var(--dimension) / 10);
}
@container (min-width: 0px) {
.frame .frame__text {
font-size: 10cqw;
}
}
/* Fade-in and zoom-in animation keyframes */
@keyframes frameStartAnimation {
from {
opacity: 0;
transform: scale(var(--start-scale));
}
to {
opacity: 1;
transform: scale(1);
}
}