POC flip

In this example below you will see how to do a POC flip with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by tibomahe, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright tibomahe ©
  • HTML
  • CSS
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>POC flip</title>
  
  
  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <div class="l-flip-container">
	<div class="c-flipper">
		<div class="c-flipper__recto">
			step 1
		</div>
		<div class="c-flipper__verso">
			step 2
		</div>
	</div>
</div>
  
  

</body>

</html>

/*Downloaded from https://www.codeseek.co/tibomahe/poc-flip-XExPJm */
.l-flip-container,
.c-flipper__recto,
.c-flipper__verso {
  width: 320px;
  height: 480px;
  margin: auto;
}

.l-flip-container {
  perspective: 1000px;
}

.c-flipper {
  position: relative;
  transition: 0.6s;
  transform-style: preserve-3d;
  animation-name: flip;
  animation-duration: 12s;
  animation-iteration-count: infinite;
}
.c-flipper__recto, .c-flipper__verso {
  backface-visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
}
.c-flipper__recto {
  z-index: 2;
  background-color: red;
}
.c-flipper__verso {
  transform: rotateY(180deg);
  background-color: green;
}

@keyframes flip {
  0% {
    transform: rotateY(0);
  }
  4.5% {
    transform: rotateY(180deg);
  }
  49.5% {
    transform: rotateY(180deg);
  }
  54% {
    transform: rotateY(0);
  }
  100% {
    transform: rotateY(0);
  }
}

Comments