<div class="box">
  <img src="https://picsum.photos/800/600/?random">
</div>
* {
  margin: 0;
  padding: 0;
}
body {
  width: 100%;
  height: 100vh;
  background-color: #e3e3e3;
  display: flex;
  justify-content: center;
  align-items: center;
}
.box {
  box-sizing: border-box;
  width: 400px;
  height: 300px;
  background-color: #0af;
  overflow: hidden;
  position: relative;
  box-shadow: 2px 2px 5px 0 #A3A3A3;
}
.box::before {
  content:'';
  width: 500px;
  height: 300px;
  opacity: 1;
  background-image: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 40%,
    rgba(255, 255, 255, 0.3) 60%,
    rgba(255, 255, 255, 0) 100%
  );
  transform-origin: center center;
  position: absolute;
  z-index: 10;
  animation-delay: 1s;
  animation-name: mask-ani;
  animation-duration: 5s;
  animation-iteration-count: infinite;
}
.box::after {
  content: '';
  width: 500px;
  height: 50px;
  opacity: 0;
  background-color: #fff;
  transform-origin: center center;
  position: absolute;
  z-index: 1;
  animation-delay: 1s;
  animation-name: mask-border-ani;
  animation-duration: 5s;
  animation-iteration-count: infinite;
}
.box img {
  width: 98%;
  vertical-align: top;
  z-index: 5;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
}
@keyframes mask-ani {
  0% {
    transform: rotate(-36deg) translate(-40px, -430px);
  }

  70%,
  100% {
    transform: rotate(-36deg) translate(-40px, 378px);
  }
}
@keyframes mask-border-ani {
  0% {
    opacity: 0.8;
    transform: rotate(-36deg) translate(-126px, -190px);
  }

  70%,
  100% {
    opacity: 0.8;
    transform: rotate(-36deg) translate(-126px, 355px);
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.