【CSS】How to implement a curtain animation that slides multiple colors continuously over an image | Demo page

Please check using Developer tools

Sponsored links

CSS

.block {
  position: relative;
  width: 768px;
  line-height: 0;
  margin: 50px auto 0;
}
.block .curtain {
  position: absolute;
  right: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: #dadada;
  z-index: 1;
}

.block .curtain:before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 100%;
  background: #e6a95d;
}

.block .curtain:after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 100%;
  background: #dadada;
}

.block.active .curtain {
  width: 0;
  transition: width .7s ease-out .7s;
}

.block.active .curtain:before {
  width: 100%;
  transition: width .5s ease-out;
}

.block.active .curtain:after {
  width: 100%;
  transition: width .4s ease-out .4s;
}

@media screen and (max-width:640px){
  .block {
    width: 100%;
  }
}
  

JavaScript

$(window).on('load', function(){
  $('.block').addClass('active');
});