<div class="center-xy">
<div class="phone-container card-container">
<div class="phone card">
<div class="front face">
<div class="phone--part camera"></div>
<div class="phone--part speaker"></div>
<div class="phone--part screen"></div>
<div class="phone--part button"></div>
</div>
<div class="back face"></div>
</div>
</div>
<input type="range" min="0" max="360" value="0" class="range-slider">
</div>
// fonts
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800');
html {
font-family: 'Open Sans', sans-serif;
background: #607d8b;
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
margin: 0;
}
// helper
.center-xy {
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
position: absolute;
}
.img-responsive {
width: 100%;
display: block;
}
// the good stuff
$phoneWidth: 200px;
$phoneHeight: 400px;
$baseColor: #fff;
$screenColor: #000;
$partsColor: #d4d4d4;
// flip
.card-container {
perspective: 800px;
.face {
width: inherit;
height: inherit;
border-radius: 20px;
overflow: hidden;
backface-visibility: hidden;
position: absolute;
}
.front {
background-color: $baseColor;
z-index: 2;
}
.back {
background-color: $baseColor;
transform: rotateY(180deg);
}
}
.phone-container {
width: $phoneWidth;
height: $phoneHeight;
margin: 50px;
position: relative;
.phone {
width: inherit;
height: inherit;
transform-style: preserve-3d;
.phone--part {
position: absolute;
}
.camera {
background-color: $partsColor;
width: 10px;
height: 10px;
margin: auto;
top: 19px;
right: 0;
left: -50px;
border-radius: 20px;
}
.speaker {
background-color: $partsColor;
width: 30px;
height: 5px;
margin: auto;
top: 22px;
right: 0;
left: 0;
border-radius: 20px;
}
.screen {
background-color: $screenColor;
width: $phoneWidth - 20px;
height: $phoneHeight - 90px;
margin: auto;
top: 45px;
right: 0;
left: 0;
}
.button {
background-color: $partsColor;
width: 25px;
height: 25px;
margin: auto;
right: 0;
bottom: 10px;
left: 0;
border-radius: 20px;
}
}
}
.range-slider {
margin: auto;
display: block;
}
View Compiled
var $rangeSlider = $('.range-slider'),
$card = $('.card');
$rangeSlider.on("input", function() {
inputValue = $rangeSlider.val();
TweenMax.to($card, .3, {
rotationX:inputValue/100,
rotationY:inputValue,
ease:Power2.easeOut});
console.log('inputValue', inputValue);
});
This Pen doesn't use any external CSS resources.