Di kesempatan kali ini kita akan coba membuat sebuah phoneSlideshow 3D untuk memamerkan sebuah aplikasi atau design yang kita buat menggunakan
CSS dan
JS .
Ok langsung saja berikut contoh full kodenya atau sobat bisa mendownload di situs resminya
http://tympanus.net/codrops/2013/08/01/3d-effect-for-mobile-app-showcase/<!-- CSS -->
<style>
*,
*:after,
*:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.ms-wrapper {
position: relative;
margin: 0 auto 120px;
width: 100%;
max-width: 65em;
padding: 0em 0em;
}
.ms-perspective {
position: relative;
margin: 0px auto;
width: 239.99952px;
height: 508px;
-webkit-perspective: 1200px;
-moz-perspective: 1200px;
perspective: 1200px;
-webkit-perspective-origin: 50% 0%;
-moz-perspective-origin: 50% 0%;
perspective-origin: 50% 0%;
}
.ms-device {
position: absolute;
width: 100%;
height: 100%;
-webkit-transition: -webkit-transform 0.7s ease-in-out;
-moz-transition: -moz-transform 0.7s ease-in-out;
transition: transform 0.7s ease-in-out;
-webkit-transform: rotateY(17deg) rotateX(10deg);
-moz-transform: rotateY(17deg) rotateX(10deg);
transform: rotateY(17deg) rotateX(10deg);
}
.ms-device,
.ms-object,
.ms-object > div,
.ms-screens a {
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.ms-object {
position: absolute;
width: 100%;
height: 100%;
-webkit-transition: -webkit-transform 0.4s;
-moz-transition: -moz-transform 0.4s;
transition: transform 0.4s;
}
.ms-object > div {
position: absolute;
display: block;
background: #181818;
}
.ms-front,
.ms-back {
width: 239.99952px;
height: 508px;
border-radius: 34px;
}
.ms-top,
.ms-bottom {
width: 30px;
height: 179.99952px;
-webkit-transform-origin: 50% 0;
-moz-transform-origin: 50% 0;
transform-origin: 50% 0;
}
.ms-left,
.ms-right {
width: 30px;
height: 448px;
}
.ms-object .ms-front {
background: #181818 url("http://i.imgur.com/x3MseRX.png") no-repeat top left;
-webkit-background-size: 100% 100%;
-moz-background-size: 100% 100%;
background-size: 100% 100%;
}
.ms-front {
-webkit-transform: rotateY(0deg) translateZ(15px);
-moz-transform: rotateY(0deg) translateZ(15px);
transform: rotateY(0deg) translateZ(15px);
}
.ms-back {
-webkit-transform: rotateX(180deg) translateZ(15px);
-moz-transform: rotateX(180deg) translateZ(15px);
transform: rotateX(180deg) translateZ(15px);
}
.ms-right {
-webkit-transform: translateY(30px) rotateY(90deg) translateZ(224.99952px);
-moz-transform: translateY(30px) rotateY(90deg) translateZ(224.99952px);
transform: translateY(30px) rotateY(90deg) translateZ(224.99952px);
}
.ms-left {
-webkit-transform: translateY(30px) rotateY(-90deg) translateZ(15px);
-moz-transform: translateY(30px) rotateY(-90deg) translateZ(15px);
transform: translateY(30px) rotateY(-90deg) translateZ(15px);
}
.ms-top {
-webkit-transform: rotateZ(-90deg) translateY(15px) rotateY(90deg);
-moz-transform: rotateZ(-90deg) translateY(15px) rotateY(90deg);
transform: rotateZ(-90deg) translateY(15px) rotateY(90deg);
}
.ms-bottom {
-webkit-transform: rotateZ(-90deg) translateY(15px) rotateY(-90deg) translateZ(508px);
-moz-transform: rotateZ(-90deg) translateY(15px) rotateY(-90deg) translateZ(508px);
transform: rotateZ(-90deg) translateY(15px) rotateY(-90deg) translateZ(508px);
}
.ms-side:before,
.ms-side:after {
position: absolute;
top: -25px;
left: 0;
width: 30px;
height: 23px;
background: #181818;
background: -webkitlinear-gradient(bottom, #181818 0%, #333333 100%);
background: -moz-linear-gradient(bottom, #181818 0%, #333333 100%);
background: linear-gradient(to top, #181818 0%, #333333 100%);
content: "";
-webkit-transform: rotateX(22.5deg) translateZ(-7px);
-moz-transform: rotateX(22.5deg) translateZ(-7px);
transform: rotateX(22.5deg) translateZ(-7px);
}
.ms-side:after {
top: 100%;
background: -webkit-linear-gradient(top, #181818 0%, #333333 100%);
background: -moz-linear-gradient(top, #181818 0%, #333333 100%);
background: linear-gradient(to bottom, #181818 0%, #333333 100%);
-webkit-transform: rotateX(-22.5deg) translateZ(-7px);
-moz-transform: rotateX(-22.5deg) translateZ(-7px);
transform: rotateX(-22.5deg) translateZ(-7px);
}
/* Screens */
.ms-screens a {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden;
}
.ms-screens > a {
position: absolute;
width: 203.99959px;
height: 362.0008px;
top: 72.9996px;
left: 17.99996px;
outline: none;
display: block;
cursor: pointer;
opacity: 1;
-webkit-transition: -webkit-transform 0.7s, opacity 0.4s;
transition: -moz-transform 0.7s, opacity 0.4s;
transition: transform 0.7s, opacity 0.4s;
-webkit-transform: translateZ(16px);
-moz-transform: translateZ(16px);
transform: translateZ(16px);
}
.ms-screens > a::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.3);
opacity: 0;
-webkit-transition: opacity 0.3s;
-moz-transition: opacity 0.3s;
transition: opacity 0.3s;
}
.ms-label {
border: 3px solid #fff;
color: #fff;
position: absolute;
left: 100%;
margin-left: 18px;
width: 200px;
padding: 10px;
opacity: 0;
-webkit-transform: rotateX(0deg);
-moz-transform: rotateX(0deg);
transform: rotateX(0deg);
-webkit-transition: opacity 0.7s, -webkit-transform 0.7s;
-moz-transition: opacity 0.7s, -moz-transform 0.7s;
transition: opacity 0.7s, transform 0.7s;
}
.ms-screens > a:hover .ms-label {
border-color: #687fa7;
color: #687fa7;
}
.ms-label::after {
right: 100%;
border: solid transparent;
content: '';
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: transparent;
border-right-color: #d9382e;
border-width: 16px;
top: 50%;
margin-top: -16px;
}
.ms-label::after,
.ms-label::before {
right: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.ms-label::after {
border-color: transparent;
border-right-color: #d2d1d5;
border-width: 12px;
top: 50%;
margin-top: -12px;
}
.ms-label::before {
border-color: transparent;
border-right-color: #fff;
border-width: 16px;
top: 50%;
margin-top: -16px;
}
.ms-screens > a:hover .ms-label::before {
border-right-color: #687fa7
}
.ms-wrapper button {
background: transparent;
font-weight: 700;
font-size: 16px;
letter-spacing: 1px;
padding: 10px 30px;
border: 3px solid #687fa7;
color: #687fa7;
position: relative;
top: 37.7em;
left: 1em;
text-transform: uppercase;
}
.ms-wrapper button:hover {
border-color: #687fa7;
color: #687fa7;
}
/* class applied to rotate phone (common effects) */
.ms-view-layers .ms-screens .ms-screen-1 {
-webkit-transform: translateZ(65px);
-moz-transform: translateZ(65px);
transform: translateZ(65px);
-webkit-transition-delay: 0.7s;
-moz-transition-delay: 0.7s;
transition-delay: 0.7s;
opacity: 0.9;
}
.ms-view-layers .ms-screens .ms-screen-2 {
-webkit-transform: translateZ(115px);
-moz-transform: translateZ(115px);
transform: translateZ(115px);
-webkit-transition-delay: 0.6s;
-moz-transition-delay: 0.6s;
transition-delay: 0.6s;
opacity: 0.9;
}
.ms-view-layers .ms-screens .ms-screen-3 {
-webkit-transform: translateZ(165px);
-moz-transform: translateZ(165px);
transform: translateZ(165px);
-webkit-transition-delay: 0.5s;
-moz-transition-delay: 0.5s;
transition-delay: 0.5s;
opacity: 0.9;
}
.ms-view-layers .ms-screens .ms-screen-4 {
-webkit-transform: translateZ(215px);
-moz-transform: translateZ(215px);
transform: translateZ(215px);
-webkit-transition-delay: 0.4s;
-moz-transition-delay: 0.4s;
transition-delay: 0.4s;
opacity: 0.9;
}
.ms-view-layers .ms-screens .ms-screen-5 {
-webkit-transform: translateZ(265px);
-moz-transform: translateZ(265px);
transform: translateZ(265px);
-webkit-transition-delay: 0.3s;
-moz-transition-delay: 0.3s;
transition-delay: 0.3s;
opacity: 0.9;
}
.ms-view-layers .ms-screens > a:hover::after {
opacity: 1
}
.ms-view-layers .ms-label {
opacity: 1;
-webkit-transform: rotateX(-90deg);
-moz-transform: rotateX(-90deg);
transform: rotateX(-90deg);
}
.ms-view-layers .ms-screen-1 .ms-label {
-webkit-transition-delay: 1.1s;
-moz-transition-delay: 1.1s;
transition-delay: 1.1s;
}
.ms-view-layers .ms-screen-2 .ms-label {
-webkit-transition-delay: 1s;
-moz-transition-delay: 1s;
transition-delay: 1s;
}
.ms-view-layers .ms-screen-3 .ms-label {
-webkit-transition-delay: 0.9s;
-moz-transition-delay: 0.9s;
transition-delay: 0.9s;
}
.ms-view-layers .ms-screen-4 .ms-label {
-webkit-transition-delay: 0.8s;
-moz-transition-delay: 0.8s;
transition-delay: 0.8s;
}
.ms-view-layers .ms-screen-5 .ms-label {
-webkit-transition-delay: 0.7s;
-moz-transition-delay: 0.7s;
transition-delay: 0.7s;
}
/* Effect 1 */
.ms-effect-1.ms-view-layers .ms-device {
-webkit-transform: rotateY(50deg) rotateX(20deg) translateZ(-15px) translateZ(-224px);
-moz-transform: rotateY(50deg) rotateX(20deg) translateZ(-15px) translateZ(-224px);
transform: rotateY(50deg) rotateX(20deg) translateZ(-15px) translateZ(-224px);
}
// --------------------------- Custom image screen ------------------------
.ms-effect-1 .ms-screens .ms-screen-1 {
background: url("https://i.imgur.com/4uLszC1.png") no-repeat center center
}
.ms-effect-1 .ms-screens .ms-screen-2 {
background: url("https://i.imgur.com/dcrQzyk.png") no-repeat center center
}
.ms-effect-1 .ms-screens .ms-screen-3 {
background: url("https://i.imgur.com/axLPUH7.png") no-repeat center center
}
.ms-effect-1 .ms-screens .ms-screen-4 {
background: url("http://i.imgur.com/EVXKwlP.png?1") no-repeat center center
}
.ms-effect-1 .ms-screens .ms-screen-5 {
background: url("https://i.imgur.com/j8CL12h.png") no-repeat center center
}
// -----------------------------------END-----------------------------------
.ms-effect-1.ms-view-layers .ms-screens .ms-screen-1 {
-webkit-transform: translateZ(85px);
-moz-transform: translateZ(85px);
transform: translateZ(85px);
}
.ms-effect-1.ms-view-layers .ms-screens .ms-screen-2 {
-webkit-transform: translateZ(155px);
-moz-transform: translateZ(155px);
transform: translateZ(155px);
}
.ms-effect-1.ms-view-layers .ms-screens .ms-screen-3 {
-webkit-transform: translateZ(225px);
-moz-transform: translateZ(225px);
transform: translateZ(225px);
}
.ms-effect-1.ms-view-layers .ms-screens .ms-screen-4 {
-webkit-transform: translateZ(295px);
-moz-transform: translateZ(295px);
transform: translateZ(295px);
}
.ms-effect-1.ms-view-layers .ms-screens .ms-screen-5 {
-webkit-transform: translateZ(365px);
-moz-transform: translateZ(365px);
transform: translateZ(365px);
}
@media screen and (max-width: 560px) {
.ms-wrapper button {
position: relative;
margin: 0 auto;
left: auto;
top: auto;
display: block;
margin-bottom: 30px;
}
}
</style>
<!-- HTML -->
<div class="ms-wrapper ms-effect-1">
<center><button>view Apps</button></center>
<div class="ms-perspective">
<div class="ms-device">
<div class="ms-object">
<div class="ms-front"></div>
<div class="ms-back"></div>
<div class="ms-left ms-side"></div>
<div class="ms-right ms-side"></div>
<div class="ms-top ms-side"></div>
<div class="ms-bottom ms-side"></div>
</div>
<div class="ms-screens">
<!------------------ Custom URL/LINK screen ------------------>
<a class="ms-screen-1" href="https://www.blogger.com/null"></a>
<a class="ms-screen-2" href="https://www.blogger.com/null"></a>
<a class="ms-screen-3" href="https://www.blogger.com/null"></a>
<a class="ms-screen-4" href="https://www.blogger.com/null"></a>
<a class="ms-screen-5" href="https://www.blogger.com/null"></a>
</div>
</div>
</div>
</div>
<!-- JS -->
<script src='https://disk-one.googlecode.com/svn/classie.js' type='text/javascript'></script>
<script src='https://disk-one.googlecode.com/svn/phoneSlideshow.js' type='text/javascript'></script>
Tags:
Read More