Color wave

In this example below you will see how to do a Color wave with some HTML / CSS and Javascript

Rebuild of this gif: http://gif.flrn.nl/post/139983856379Time spend: 45min Licence: VVL - Vitual Vomit Licence

Thumbnail
This awesome code was written by schoenwaldnils, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright schoenwaldnils ©
  • HTML
  • CSS
  • JavaScript
    .Grid
  - 54.times do
    .Row
      - 30.times do
        .Box

/*Downloaded from https://www.codeseek.co/schoenwaldnils/color-wave-reaWpL */
    $s: 3.3333333333vw;
$n_row: 54;
$n_column: 30;
$t: .7s;
$c: (
  #612E8D, // purple 
  #1674BC, // blue
  #00A396, // turquoise
  #81C540, // green
  #F5B52E, // yellow
  #ED5B35, // orange
  #EA225E, // red
  #C22286, // pink
);

body {
  background-color: #262626;
  overflow: hidden;
}

.Grid {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  width: $s * $n_column;
  height: $s * $n_row;
}

.Row {
  display: flex;
  flex-grow: 1;
}

.Box {
  position: relative;
  flex-grow: 1;
  margin: $s * .05;
  border-radius: $s * .1;
  background-color: #fff;
  animation: scale $t infinite alternate-reverse;
}

@for $i from 1 through $n_row {
  @for $j from 1 through $n_column {
    $x: $i + $j - 1;
    $d: $t / $n_column * ($i + $j);
    $x: $x % 8 + 1;
    .Row:nth-child(#{$i}) .Box:nth-child(#{$j}) {
      background-color: nth($c, $x);
    }

    .Row:nth-last-child(#{$i}) .Box:nth-last-child(#{$j}) {
      animation-delay: $d * -3;
    }
  }
}

@keyframes scale {
  to { transform: scale(.2); }
}


/*Downloaded from https://www.codeseek.co/schoenwaldnils/color-wave-reaWpL */
    

Comments