AI CSS Animations

Folder Files Rising

Three sheets rise out of an isometric file folder on staggered springs, the middle one tagged in the accent, then slide back in. Upright SVG planes moved by CSS translate.

Also known as: folder animation, file upload animation, hairline isometric.

HTML

<div class="hln-folder-files" role="img" aria-label="Files rising out of a folder">
  <svg viewBox="-110 -60 220 120" aria-hidden="true"><g transform="translate(0 22) scale(1.55)"><polygon points="-14,-13 26,7 18,11 -22,-9"/><polygon points="-14,-13 26,7 26,-19 -1,-32.5 -1,-35.5 -14,-42"/><g class="hln-folder-files-s0"><polygon points="-12,-12 18,3 18,-19 -12,-34"/><line class="hln-folder-files-in" x1="-9" y1="-29" x2="3" y2="-23"/><line class="hln-folder-files-in" x1="-9" y1="-26" x2="11" y2="-16"/><line class="hln-folder-files-in" x1="-9" y1="-23" x2="7" y2="-15"/></g><g class="hln-folder-files-s1"><polygon points="-14,-11 16,4 16,-18 -14,-33"/><line class="hln-folder-files-in" x1="-11" y1="-28" x2="1" y2="-22"/><line class="hln-folder-files-in" x1="-11" y1="-25" x2="9" y2="-15"/><line class="hln-folder-files-in" x1="-11" y1="-22" x2="5" y2="-14"/><polygon class="hln-folder-files-hot" points="11,-16 15,-14 15,-16 11,-18"/></g><g class="hln-folder-files-s2"><polygon points="-16,-10 14,5 14,-17 -16,-32"/><line class="hln-folder-files-in" x1="-13" y1="-27" x2="-1" y2="-21"/><line class="hln-folder-files-in" x1="-13" y1="-24" x2="7" y2="-14"/><line class="hln-folder-files-in" x1="-13" y1="-21" x2="3" y2="-13"/></g><polygon points="-22,-9 18,11 18,-7 -22,-27"/><polygon class="hln-folder-files-in" points="-8,-10 4,-4 4,-7 -8,-13"/></g></svg>
</div>

CSS

.hln-folder-files {
  --c: var(--hln-color, #ff4f2e);
  font-size: var(--hln-size, 16px);
  position: relative;
  display: grid;
  place-items: center;
  width: 22em;
  height: 12em;
  border-radius: 0.75em;
  background: #f6f5f1;
  overflow: hidden;
  --u: 1px;
}
.hln-folder-files svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: #ffffff;
  stroke: #1c1d21;
  stroke-width: 1.25;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.hln-folder-files svg * {
  vector-effect: non-scaling-stroke;
}
.hln-folder-files .hln-folder-files-in {
  stroke: #9a9ca3;
}
.hln-folder-files .hln-folder-files-hot {
  fill: var(--c);
  stroke: var(--c);
}
.hln-folder-files .hln-folder-files-s0 {
  animation: hln-folder-files-s0 5.6s infinite;
}
.hln-folder-files .hln-folder-files-s1 {
  animation: hln-folder-files-s1 5.6s infinite;
}
.hln-folder-files .hln-folder-files-s2 {
  animation: hln-folder-files-s2 5.6s infinite;
}
@keyframes hln-folder-files-s0 {
  0% { translate: 0 0; }
  8% { translate: 0 0; animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1); }
  14.6% { translate: 0 calc(-7.56 * var(--u)); animation-timing-function: ease-in-out; }
  17.6% { translate: 0 calc(-6.86 * var(--u)); animation-timing-function: ease-in-out; }
  20% { translate: 0 calc(-7 * var(--u)); }
  74% { translate: 0 calc(-7 * var(--u)); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  86% { translate: 0 0; }
  100% { translate: 0 0; }
}
@keyframes hln-folder-files-s1 {
  0% { translate: 0 0; }
  11% { translate: 0 0; animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1); }
  17.6% { translate: 0 calc(-15.12 * var(--u)); animation-timing-function: ease-in-out; }
  20.6% { translate: 0 calc(-13.72 * var(--u)); animation-timing-function: ease-in-out; }
  23% { translate: 0 calc(-14 * var(--u)); }
  76% { translate: 0 calc(-14 * var(--u)); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  88% { translate: 0 0; }
  100% { translate: 0 0; }
}
@keyframes hln-folder-files-s2 {
  0% { translate: 0 0; }
  14% { translate: 0 0; animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1); }
  20.6% { translate: 0 calc(-4.32 * var(--u)); animation-timing-function: ease-in-out; }
  23.6% { translate: 0 calc(-3.92 * var(--u)); animation-timing-function: ease-in-out; }
  26% { translate: 0 calc(-4 * var(--u)); }
  78% { translate: 0 calc(-4 * var(--u)); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  90% { translate: 0 0; }
  100% { translate: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hln-folder-files * {
    animation: none !important;
  }
  .hln-folder-files .hln-folder-files-s0 { translate: 0 calc(-7 * var(--u)); }
  .hln-folder-files .hln-folder-files-s1 { translate: 0 calc(-14 * var(--u)); }
  .hln-folder-files .hln-folder-files-s2 { translate: 0 calc(-4 * var(--u)); }
}

@media (prefers-reduced-motion: reduce) {
  .hln-folder-files, .hln-folder-files *, .hln-folder-files::before, .hln-folder-files::after, .hln-folder-files *::before, .hln-folder-files *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --hln-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --hln-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 16px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar hairline animations