Blossom Carousel Logo
Advanced

Cover Flow

Create a cover-flow carousel effect with CSS scroll-driven animations.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
.carousel {
  padding-inline: calc(50% - 50px);
  scroll-snap-type: x mandatory;
}

ul {
  white-space: nowrap;
  transform-style: preserve-3d;
}

li {
  display: inline-block;
  position: relative;
  width: 100px;
  aspect-ratio: 1 / 2;
  transform-style: preserve-3d;
  scroll-snap-align: center;

  view-timeline: --slide inline calc(50% - 140px);
}

.slide {
  perspective: 500px;
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  aspect-ratio: 1;
  transform-style: preserve-3d;

  animation: linear slide-cover both;
  animation-timeline: --slide;
  animation-range: contain;
}

.card {
  width: 100%;
  height: 100%;

  animation: linear rotate-cover both;
  animation-timeline: --slide;
  animation-range: contain;
}

@keyframes rotate-cover {
  0% {
    transform: rotateY(-55deg);
  }
  50% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(55deg);
  }
}

@keyframes slide-cover {
  0% {
    transform: translateX(30%);
  }
  50% {
    transform: translateX(0) scale(1.2);
  }
  100% {
    transform: translateX(-30%);
  }
}