Clip-path polygon

by Simon Hi

HTML

<div>
  <h1>Projets réalisés</h1>
  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f4/2013.05.18.-32-Kirschgartshaeuser_Schlaege_Mannheim-Braune-Krabbenspinne-Weibchen.jpg/1000px-2013.05.18.-32-Kirschgartshaeuser_Schlaege_Mannheim-Braune-Krabbenspinne-Weibchen.jpg">
</div>

CSS

body {
  margin: 0;
  padding: 0;
}

div {
  box-sizing: border-box;
  width: 346px;
  height: 280px;
  background: red;
  position: relative;
  background: #fcaf5c;
  color: #fff;
  padding: 0.125em;
  font-family: sans-serif;
}

h1 {
  text-align: center;
}

@keyframes trans {
  from {
    clip-path: polygon(0 0, 0 100%, 100% 100%, 150% 0, 160% 0, 110% 100%, 120% 100%, 170% 0, 180% 0, 130% 100%, 140% 100%, 190% 0, -100% 0);
  }

  to {
    clip-path: polygon(-200% 0, -200% 100%, -100% 100%, -50% 0, -40% 0, -90% 100%, -80% 100%, -30% 0, -20% 0, -70% 100%, -60% 100%, -10% 0, -100% 0);
  }
}

img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  animation: trans 4s linear 1s forwards infinite;
  width: 100%;
  clip-path: polygon(0 0, 0 100%, 100% 100%, 150% 0, 160% 0, 110% 100%, 120% 100%, 170% 0, 180% 0, 130% 100%, 140% 100%, 190% 0, -100% 0);
}