Gallery · 11 of 33

Slice Reveal

Image split into sliding strips

HTML · CSS · No dependencies · MIT

HTML

<div class="slice-reveal">
  <img src="https://picsum.photos/id/60/800/600" alt="Computer">
  <div class="slice s1"></div>
  <div class="slice s2"></div>
  <div class="slice s3"></div>
</div>

CSS

.slice-reveal {
  position: relative;
  width: 400px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 12px;
}

.slice-reveal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slice {
  position: absolute;
  top: 0;
  height: 100%;
  width: 33.34%;
  background: #0a0a0f;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2;
}

/* Alternate origins so the strips wipe in opposite directions */
.s1 { left: 0; transform-origin: top; }
.s2 { left: 33.33%; transform-origin: bottom; transition-delay: 0.1s; }
.s3 { left: 66.66%; transform-origin: top; transition-delay: 0.2s; }

.slice-reveal:hover .slice {
  transform: scaleY(0);
}