<div class="button">
<div class="inner">
<div class="top"></div>
<div class="side"></div>
<div class="bottom"></div>
<div class="menu">
<div class="lines">
<div class="line"></div>
<div class="line"></div>
</div>
</div>
<div class="particles">
<div class="particle"></div>
<div class="particle"></div>
<div class="particle"></div>
<div class="particle"></div>
</div>
</div>
</div>
@keyframes floating-menu {
0% {
transform: translate3d(-50%, -50%, 0);
}
25% {
transform: translate3d(-50%, -60%, 0);
}
75% {
transform: translate3d(-50%, -40%, 0);
}
100% {
transform: translate3d(-50%, -50%, 0);
}
}
@keyframes shadow {
0% {
transform: rotateX(90deg) translate3d(0, 0, -12px) scale(0.8);
}
25% {
transform: rotateX(90deg) translate3d(0, 0, -12px) scale(0.6);
}
75% {
transform: rotateX(90deg) translate3d(0, 0, -12px) scale(1);
}
100% {
transform: rotateX(90deg) translate3d(0, 0, -12px) scale(0.8);
}
}
* {
box-sizing: border-box;
}
body {
background: #FFAEAE;
}
.button {
position: absolute;
top: calc( 50% - 35px );
left: calc( 50% - 35px );
width: 74px;
height: 74px;
border-radius: 50%;
cursor: pointer;
perspective: 500px;
transform: translate3d(0, 0, 0);
transform-style: preserve-3d;
.inner {
position: relative;
width: 100%;
height: 100%;
perspective: 500px;
perspective-origin: 50% 500%;
transition: transform 0.5s cubic-bezier(0.645, 0.045, 0.355, 1.000);
transform-style: preserve-3d;
}
.top,
.bottom {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
bacface-visibility: hidden;
border-radius: 50%;
}
.top {
background: #ffd364;
border: 3px solid #8a97ff;
overflow: hidden;
transform: translate3d(0, 0, 0);
z-index: 2;
&:before {
display: block;
position: absolute;
top: -25%;
left: 0;
width: 100%;
height: 25%;
background: white;
content: '';
opacity: 0.5;
transform: scaleY(1);
transform-origin: 0 0;
transition: transform 0.5s cubic-bezier(0.645, 0.045, 0.355, 1.000);
}
}
.bottom {
background: #fc7a5b;
border: 3px solid #8a97ff;
transform: translate3d(0, 0, -20px);
}
.side {
position: absolute;
top: 50%;
left: 0;
width: 100%;
height: 20px;
;
background: #fc7a5b;
bacface-visibility: hidden;
border-color: #8a97ff;
border-style: solid;
border-width: 0 3px;
// opacity: 0.5;
transform: rotateX(-90deg);
transform-origin: 50% 0;
z-index: 1;
}
.menu {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transition: transform 0.5s cubic-bezier(0.645, 0.045, 0.355, 1.000);
transform-style: preserve-3d;
z-index: 2;
&:after {
display: block;
position: absolute;
top: 35px;
left: 26px;
width: 22px;
height: 10px;
background: black;
border-radius: 50%;
content: '';
opacity: 0;
transform: rotateX(90deg) translate3d(0, 0, -12px) scale(0.8);
transition: opacity 0.25s linear 0s;
}
.lines {
display: block;
position: absolute;
top: 50%;
left: 50%;
width: 21px;
height: 14px;
transform: translate3d(-50%, -50%, 0);
z-index: 2;
}
.line {
width: 21px;
height: 4px;
background: #8a97ff;
border-radius: 4px;
&:last-child {
margin-top: 5px;
}
}
}
}
@keyframes particle {
0% {
bottom: 0;
opacity: 1;
}
100% {
bottom: 50px;
opacity: 0;
}
}
.particles {
position: absolute;
bottom: 50%;
left: 0;
width: 100%;
height: 100%;
transform: rotateX(-90deg);
transform-origin: 50% 100%;
transform-style: preserve-3d;
.particle {
position: absolute;
bottom: 0;
width: 2px;
height: 2px;
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-iteration-count: infinite;
background: #8a97ff;
border-radius: 50%;
opacity: 0;
transition: opacity 0.25s linear 0s;
&:nth-child(1) {
left: 20%;
animation-delay: 0.13s;
animation-duration: 2s;
transform: translate3d(0, 0, -10px);
}
&:nth-child(2) {
left: 35%;
animation-duration: 4s;
transform: translate3d(0, 0, 15px);
}
&:nth-child(3) {
left: 65%;
animation-delay: 0.35s;
animation-duration: 3s;
transform: translate3d(0, 0, -25px);
}
&:nth-child(4) {
left: 80%;
animation-delay: 0.29s;
animation-duration: 2.5s;
transform: translate3d(0, 0, 5px);
}
}
}
.button:hover {
.inner {
transform: rotateX(50deg);
}
.top {
&:before {
transform: translate3d(0, 500%, 0) scaleY(1);
}
}
.menu {
transform: translate3d(0, 0, 20px) rotateX(-90deg) scale(1.5);
&:after {
animation: shadow 3s linear infinite;
opacity: 0.1;
transition: opacity 0.25s linear 0.1s;
}
.lines {
animation: floating-menu 3s linear infinite;
}
}
.particles {
.particle {
animation-name: particle;
opacity: 1;
transition: opacity 0.25s linear 0.1s;
}
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.