Transition et boucle

Découvrez l'exemple
<div class="wrapper">
  <div class="col animated"></div>
  <div class="col animated"></div>
  <div class="col animated"></div>
  <div class="col animated"></div>
  <div class="col animated"></div>
  <div class="col animated"></div>
  <div class="col animated"></div>
  <div class="col animated"></div>
  <div class="col animated"></div>
  <div class="col animated"></div>
  <div class="col animated"></div>
  <div class="col animated"></div>
</div>
@function make-darker($value) {
    @return $value - rgb(50,50,50); 
}
 
@for $i from 1 through 12 {
  $colors: 
    #1abc9c, 
    #f1c40f, 
    #e74c3c, 
    #2c3e50, 
    #3498db, 
    #40d47e, 
    #16a085, 
    #c0392b, 
    #8e44ad, 
    #5677fc, 
    #8bc34a, 
    #673ab7;
 
  .animated:nth-child(#{$i}) {
    $couleur: nth($colors, $i);
    background: $couleur;
    &:hover{
      background: make-darker($couleur);
     // background: nth($colors, 2);
      top:20px;
    }
  }
 
}
 
.col {
  background: #000;
  position:relative;
  top:0;
  transition: all 300ms linear 0ms;
  width: 100px;
  height: 100px;
  float: left;
  margin: 10px auto;
  box-shadow: 0 1.5px 4px rgba(0, 0, 0, 0.24), 0 1.5px 6px rgba(0, 0, 0, 0.12);
}
 
.wrapper {
  height: 100vh;
  display: flex;
  justify-content: space-around;
  align-items: center;
  text-align: center;
}