JSFiddle - React, Tailwind, and code Playground

by Eduard Dyckman

HTML

<div class="chart">
  <div class="rect">
   
  </div>
  <div class="rect">
  
  </div>
  <div class="rect">
  
  </div>
  <div class="rect">
  
  </div>
</div>

CSS

.chart {
  display: flex;
  align-items: flex-end;
  height: 200px;
}
.rect {
  width: 50px;
  background-color: blue;
  margin-right: 5px;
  transform-origin: bottom;
  animation: 2s ease-in-out;
  animation-iteration-count: 3;
}
.rect:nth-child(1) {
  height: 50px;
  animation-name: updown1;
}
.rect:nth-child(2) {
  height: 100px;
  animation-name: updown2;
}
.rect:nth-child(3) {
  height: 150px;
  animation-name: updown3;
}
.rect:nth-child(4) {
  height: 200px;
  animation-name: updown2;
}

@keyframes updown1 {
  0% {
    background-color: grey;
    transform: scaleY(1);
  }
  50% {
   background-color: grey;
   transform: scaleY(0.2);
  }
  100% {
    background-color: grey;
    transform: scaleY(1);
  }
}
@keyframes updown2 {
  0% {
    background-color: grey;
    transform: scaleY(1);
  }
  20% {
   background-color: grey;
   transform: scaleY(0.5);
  }
  100% {
    background-color: grey;
    transform: scaleY(1);
  }
}
@keyframes updown3 {
  0% {
    background-color: grey;
    transform: scaleY(1);
  }
  80% {
   background-color: grey;
   transform: scaleY(0.2);
  }
  100% {
    background-color: grey;
    transform: scaleY(1);
  }
}