JSFiddle - React, Tailwind, and code Playground
HTML
<body scroll="no">
<div class="content" id="device">
<div class="device">
<div class="device__screen">
<div id="menu-icon-wrapper" class="menu-icon-wrapper" style="visibility: hidden">
<svg width="1000px" height="1000px">
<path id="pathA" d="M 300 400 L 700 400 C 900 400 900 750 600 850 A 400 400 0 0 1 200 200 L 800 800"></path>
<path id="pathB" d="M 300 500 L 700 500"></path>
<path id="pathC" d="M 700 600 L 300 600 C 100 600 100 200 400 150 A 400 380 0 1 1 200 800 L 800 200"></path>
</svg>
<button id="menu-icon-trigger" class="menu-icon-trigger"></button>
</div><!-- menu-icon-wrapper -->
<div id="dummy" class="dummy">
<div class="dummy__item" class="dummy__item"><font size="6"><center>AUSFÜLLEN!</center></font></div>
<div class="dummy__item" class="dummy__item"><font size="6"><center>AUSFÜLLEN!</center></font></div>
<div class="dummy__item" class="dummy__item"><font size="6"><center>AUSFÜLLEN!</center></font></div>
<div class="dummy__item" class="dummy__item"><font size="6"><center>AUSFÜLLEN!</center></font></div>
</div><!-- /dummy -->
</div><!-- /device-content -->
</div><!-- /device -->
</div><!-- /content -->
<script src="js/main.js"></script>
</body>
CSS
.device {
position: relative;
overflow: hidden;
left: 40em;
/*bottom: -39.6em;*/
bottom: -65em;
width: 40em;
margin: 0 auto;
transition: bottom 1s linear;
background: url(../img/iphone_white.svg) no-repeat 50% 0%;
background-size: 100%;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-touch-callout: none;
-khtml-user-select: none;
}
#device div:hover {
bottom:1px;
}
.device__screen {
position: relative;
overflow: hidden;
height: 100%;
margin: 11em 13.75% 0;
text-align: left;
border-radius: 4px 4px 0 0;
box-shadow: inset 0 6.2em 0 rgba(0, 0, 0, 0.1);
}
.device__screen {
background-image: url("http://fs5.directupload.net/images/160807/w6bn84ci.png");
}
.device--alt .device__screen {
background: #4ECE77;
}
.dummy__item {
height: 3em;
margin: 1em 1.25em;
/*pointer-events: none;*/
border-radius: 4px;
color: black;
background: rgba(255,255,255, 0.6);
-webkit-transition: -webkit-transform 0.5s;
transition: transform 0.5s;
-webkit-transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);
transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);
}
.dummy__item {
-webkit-transform: translate3d(-100%, 0, 0) translate3d(-2em, 0, 0) scale3d(0.5, 1, 1);
transform: translate3d(-100%, 0, 0) translate3d(-2em, 0, 0) scale3d(0.5, 1, 1);
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
}
.device--alt .dummy__item {
-webkit-transform: translate3d(0, 260px, 0) scale3d(1, 0.2, 1);
transform: translate3d(0, 260px, 0) scale3d(1, 0.2, 1);
}
.dummy--active .dummy__item {
-webkit-transition-timing-function: cubic-bezier(0.56, 1.19, 0.2, 1.05);
transition-timing-function: cubic-bezier(0.56, 1.19, 0.2, 1.05);
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.dummy__item:nth-child(4),
.dummy--active .dummy__item:first-child {
-webkit-transition-delay: 0.05s;
transition-delay: 0.05s;
}
.dummy__item:nth-child(3),
.dummy--active...
JavaScript
(function() {
var beginAC = 80,
endAC = 320,
beginB = 80,
endB = 320;
function inAC(s) {
s.draw('80% - 240', '80%', 0.3, {
delay: 0.1,
callback: function() {
inAC2(s)
}
});
}
function inAC2(s) {
s.draw('100% - 545', '100% - 305', 0.6, {
easing: ease.ease('elastic-out', 1, 0.3)
});
}
function inB(s) {
s.draw(beginB - 60, endB + 60, 0.1, {
callback: function() {
inB2(s)
}
});
}
function inB2(s) {
s.draw(beginB + 120, endB - 120, 0.3, {
easing: ease.ease('bounce-out', 1, 0.3)
});
}
function outAC(s) {
s.draw('90% - 240', '90%', 0.1, {
easing: ease.ease('elastic-in', 1, 0.3),
callback: function() {
outAC2(s)
}
});
}
function outAC2(s) {
s.draw('20% - 240', '20%', 0.3, {
callback: function() {
outAC3(s)
}
});
}
function outAC3(s) {
s.draw(beginAC, endAC, 0.7, {
easing: ease.ease('elastic-out', 1, 0.3)
});
}
function outB(s) {
s.draw(beginB, endB, 0.7, {
delay: 0.1,
easing: ease.ease('elastic-out', 2, 0.4)
});
}
var pathA = document.getElementById('pathA'),
pathB = document.getElementById('pathB'),
pathC = document.getElementById('pathC'),
segmentA = new Segment(pathA, beginAC, endAC),
segmentB = new Segment(pathB, beginB, endB),
segmentC = new Segment(pathC, beginAC, endAC),
trigger = document.getElementById('menu-icon-trigger'),
toCloseIcon = true,
dummy = document.getElementById('dummy'),
wrapper = document.getElementById('menu-icon-wrapper');
wrapper.style.visibility = 'visible';
trigger.onclick = function() {
if (toCloseIcon) {
inAC(segmentA);
inB(segmentB);
inAC(segmentC);
dummy.className = 'dummy dummy--active';
} else {
outAC(segmentA);
outB(segmentB);
outAC(segmentC);
dummy.className =...