Skip to content

Hopscotch

Bounce · Hopping row · playful, ui

Customize

HTML

<div class="utw-loader-hopscotch" role="status">
  <span class="utw-loader-hopscotch__cell"><span class="utw-loader-hopscotch__shadow"></span><span class="utw-loader-hopscotch__ball"></span></span>
  <span class="utw-loader-hopscotch__cell"><span class="utw-loader-hopscotch__shadow"></span><span class="utw-loader-hopscotch__ball"></span></span>
  <span class="utw-loader-hopscotch__cell"><span class="utw-loader-hopscotch__shadow"></span><span class="utw-loader-hopscotch__ball"></span></span>
  <span class="utw-loader-hopscotch__cell"><span class="utw-loader-hopscotch__shadow"></span><span class="utw-loader-hopscotch__ball"></span></span>
  <span class="utw-loader-hopscotch__sr">Loading…</span>
</div>

CSS

/* Bounce loader (Hopping row) */
.utw-loader-hopscotch {
  box-sizing: border-box;
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  gap: 6px;
  height: 48px;
}

.utw-loader-hopscotch *,
.utw-loader-hopscotch *::before,
.utw-loader-hopscotch *::after {
  box-sizing: border-box;
}

.utw-loader-hopscotch__cell {
  position: relative;
  display: block;
  width: 11px;
  height: 100%;
}

.utw-loader-hopscotch__ball {
  position: absolute;
  bottom: 2px;
  left: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #0d9488;
  transform-origin: 50% 100%;
  animation: utw-loader-hopscotch-fall 0.6s ease-in infinite alternate;
}

.utw-loader-hopscotch__shadow {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 11px;
  height: 2px;
  border-radius: 50%;
  background: #99f6e4;
  animation: utw-loader-hopscotch-shadow 0.6s ease-in infinite alternate;
}

.utw-loader-hopscotch__cell:nth-child(1) > * {
  animation-delay: -1.2s;
}

.utw-loader-hopscotch__cell:nth-child(2) > * {
  animation-delay: -1.05s;
}

.utw-loader-hopscotch__cell:nth-child(3) > * {
  animation-delay: -0.9s;
}

.utw-loader-hopscotch__cell:nth-child(4) > * {
  animation-delay: -0.75s;
}

.utw-loader-hopscotch__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes utw-loader-hopscotch-fall {
  0% {
    transform: translateY(-26px);
  }
  85% {
    transform: translateY(0) scale(1, 1);
  }
  100% {
    transform: translateY(0) scale(1.25, 0.75);
  }
}

@keyframes utw-loader-hopscotch-shadow {
  0% {
    transform: scale(0.45);
    opacity: 0.35;
  }
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
}

@keyframes utw-loader-hopscotch-calm {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .utw-loader-hopscotch *,
  .utw-loader-hopscotch *::before,
  .utw-loader-hopscotch *::after {
    animation: none !important;
  }
  .utw-loader-hopscotch {
    animation: utw-loader-hopscotch-calm 2s ease-in-out infinite alternate !important;
  }
}

Related loaders