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
@import "~sass-math/math";
//vars
$fg: #ff4081;
$bg: #3f51b5;
$pi: pi();
//config
$menu-items: 5;
$open-distance: 115px;
$opening-angle: $pi - .2;
%goo {
filter: url('#shadowed-goo');
// debug
//background:rgba(255,0,0,0.2);
}
%ball {
background: $fg;
border-radius: 100%;
width: 80px;
height: 80px;
margin-left: -40px;
position: absolute;
top: 20px;
color: white;
text-align: center;
line-height: 80px;
transform: translate3d(0, 0, 0);
transition: transform ease-out 200ms;
}
.menu-open {
display: none;
}
.menu-item {
@extend %ball;
}
.hamburger {
$width: 25px;
$height: 3px;
width: $width;
height: $height;
background: white;
display: block;
position: absolute;
top: 50%;
left: 50%;
margin-left: -$width/2;
margin-top: -$height/2;
transition: transform 200ms;
}
$hamburger-spacing: 8px;
.hamburger-1 {
transform: translate3d(0, -$hamburger-spacing, 0);
}
.hamburger-2 {
transform: translate3d(0, 0, 0);
}
.hamburger-3 {
transform: translate3d(0, $hamburger-spacing, 0);
}
.menu-open:checked + .menu-open-button {
.hamburger-1 {
transform: translate3d(0, 0, 0) rotate(45deg);
}
.hamburger-2 {
transform: translate3d(0, 0, 0) scale(0.1, 1);
}
.hamburger-3 {
transform: translate3d(0, 0, 0) rotate(-45deg);
}
}
.menu {
@extend %goo;
$width: 380px;
$height: 250px;
position: absolute;
left: 50%;
margin-left: -$width/2;
padding-top: 20px;
padding-left: $width/2;
width: $width;
height: $height;
box-sizing: border-box;
font-size: 20px;
text-align: left;
}
.menu-item {
&:hover {
background: white;
color: $fg;
}
@for $i from 1 through $menu-items {
&:nth-child(#{$i+2}) {
transition-duration: 10ms+(60ms*($i));
}
}
}
.menu-open-button {
@extend %ball;
z-index: 2;
transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.275);
transition-duration: 400ms;
transform: scale(1.1, 1.1) translate3d(0, 0, 0);
cursor: pointer;
}
.menu-open-button:hover {
transform: scale(1.2, 1.2) translate3d(0, 0, 0);
}
.menu-open:checked + .menu-open-button {
transition-timing-function: linear;
transition-duration: 200ms;
transform: scale(0.8, 0.8) translate3d(0, 0, 0);
}
.menu-open:checked ~ .menu-item {
transition-timing-function: cubic-bezier(0.935, 0.000, 0.340, 1.330);
@for $i from 1 through $menu-items {
$angle: (($pi - $opening-angle)/2)+(($opening-angle/($menu-items - 1))*($i - 1)+($pi*0.43));
&:nth-child(#{$i+2}) {
transition-duration: 80ms+(80ms*$i);
transform: translate3d(sin($angle)*$open-distance, cos($angle)*$open-distance, 0);
}
}
}