* {
    margin: 0;
    padding: 0;
    border: 0;
}

body {
    width: 640px;
    height: 960px;
}

img {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 640px;
    height: 960px;
    -webkit-transition-property: -webkit-transform;
    -webkit-transition-duration: 3s;
    opacity: 0;
    -webkit-transform: rotateY(-180deg);
    -webkit-backface-visibility: hidden;
}

img.out {
    -webkit-transform: rotateY(180deg);
    opacity: 1;
}

img.in {
    -webkit-transform: rotateY(0deg);
    opacity: 1;
}
img.stay {
    -webkit-transform: rotateY(-180deg);
    opacity: 0;
}
