Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                
    <body xmlns="http://www.w3.org/2000/svg" class="text-center">
  <div style= "margin:50px 15%;">
    <h2>Animated Weather Icons</h2>
  <div class="icon" >
    <div class="cloud2 small-cloud"></div>
    <div class="cloud2"></div>
  </div>
  
 <div class="icon">
  <div class="cloud2"></div>
  <div class="rain"></div>
</div>
  
  <div class="icon" >
    <div class= "cloud2"></div>
    <div class="thunder">
      <div class="bolt"></div>
        <div class="bolt"></div>
    </div>
  </div>
  
  <div class="icon">
    <div class="rays">
    <div class="ray"></div>
    <div class="ray"></div>
    <div class="ray"></div>
    <div class="ray"></div>
    </div>
    <div class="sun"></div>
  </div>

      <div class="icon">
          <div class="cloud2"></div>
          <div class="drizzle"></div>
      </div>

      <div class="icon">
          <div class="cloud2"></div>
          <div class="snow">
          <div class="flake"></div>
          <div class="flake"></div>
          <div class="flake"></div>
          <div class="flake"></div>
            </div>
      </div>
    
    <div class="icon">
      <div class="extreme text-center">
        <div class="harsh-wind"></div>
        <div class="harsh-wind"></div>
        <div class="harsh-wind"></div>
        <div class="harsh-wind"></div>
        <div class="harsh-wind"></div>
        <div class="harsh-wind"></div>
        <div class="harsh-wind"></div>
      </div>
    </div>
      
  </div>
      
<p>by <a href="https://codepen.io/ysajid" style="color:white;">ysajid</a></p>
<p>Inspired by <u><a target="_blank"href="https://codepen.io/joshbader/pen/EjXgqr"  style="color:rgba(255,255,255,.5);">this pen</a></u> by joshbader</p>
</body>
              
            
!

CSS

              
                @charset "UTF-8";
$bg-color: #181c1d;
$bg-color-light: rgba(255, 255, 255, 0.2);
$bg-color-lighter: rgba(255, 1255, 255, 0.1);
$color-accent: white;
body {
  font-family: Source Sans Pro;
  background: $bg-color;
  color:rgba(255,255,255,.5);
}

#rainy {
  position: absolute;
  top: 50%;
  left: 50%;
}

#thunder {
  position: absolute;
  top: 50%;
}


/*here is the icon class */

.icon {
  position: relative;
  display: inline-block;
  background-color: #181c1d;
  margin: 5%;
  width: 4em;
  height: 4em;
  font-size: 1em;
}

.cloud2 {
  color: $bg-color;
  background: $bg-color;
  position: absolute;
  width: 3.4875em;
  height: 3.4875em;
  border-radius: 50%;
  box-shadow: 2.0625em 0.9375em 0 -0.9375em, 0 0 0 0.375em $color-accent, 2.0625em 0.9375em 0 -0.5625em $color-accent;
}

.cloud2:after {
  color: $bg-color;
  background: $bg-color;
  content: '';
  position: absolute;
  bottom: 0;
  left: 1.8em;
  display: block;
  width: 2.0em;
  height: 1em;
  box-shadow: 0 0.4375em 0 -0.0625em $color-accent;
}

.small-cloud {
  background: $bg-color;
  box-shadow: 2.0625em 0.9375em 0 -0.9375em, 0 0 0 0.375em $color-accent, 2.0625em 0.9375em 0 -0.5625em $color-accent;
  opacity: 0.3;
  transform: scale(0.5) translate(6em, -3em);
  animation: move 5s infinite linear;
}

.sun {
  color: $bg-color;
  background: $bg-color;
  position: absolute;
  width: 2.5em;
  margin: .8em;
  height: 2.5em;
  border-radius: 50%;
  box-shadow: 0 0 0 .375em $color-accent;
}

.rays {
  position: relative;
  transform: translate(1.1em, -0.8em)}

.ray {
  color: $bg-color;
  background: $bg-color;
  position: absolute;
  margin: .8em;
  width: .4em;
  height: 4.2em;
  box-shadow: 0 .5em 0 0 $color-accent, 0 -.5em 0 0 $color-accent;
}

.ray:nth-child(1) {
  animation: spin-0 10s infinite linear;
}

.ray:nth-child(2) {
  transform: rotate(45deg);
  animation: spin-45 10s infinite linear;
}

.ray:nth-child(3) {
  transform: rotate(90deg);
  animation: spin-90 10s infinite linear;
}

.ray:nth-child(4) {
  transform: rotate(135deg);
  animation: spin-135 10s infinite linear;
}

.thunder,
.snow,
.haze,
.drizzle,
.rain {
  transform: translate(1.3em, 2.2em);
  width: 2.8em;
  height: 2.5em;
  background: $bg-color;
  position: absolute;
}

.extreme {
  background: $bg-color;
}

.rain:after {
  content: '';
  position: absolute;
  display: block;
  z-index: 2;
  color: $color-accent;
  background: $color-accent;
  width: .3em;
  height: 1.0em;
  border-radius: .15em;
  transform: translate(0.4em, 0.2em) rotate(20deg);
  animation: rain 2s infinite ease-in-out;
  box-shadow: .6em .6em, 1.2em -.2em, 1.2em 1.2em, 1.8em .2em;
}

.drizzle:after {
  z-index: 2;
  content: '';
  position: absolute;
  display: block;
  color: $color-accent;
  background: $color-accent;
  width: .4em;
  height: .4em;
  border-radius: 50%;
  transform: translate(0.1em, .6em);
  box-shadow: .4em .4em, .8em 0em, 1.2em .4em, 1.6em 0em, 2em .4em, .8em .8em, 1.2em .4em, 1.6em .8em, .4em 1.2em, 1.2em 1.2em, .8em 1.6em;
  animation: drizzle 2s infinite linear;
}

.flake {
  position: absolute;
  display: block;
}

.flake:nth-child(1) {
  transform: scale(2) translate(.1em, -.2em);
}

.flake:nth-child(1):after {
  z-index: 2;
  color: $color-accent;
  position: absolute;
  animation: spin 7s infinite reverse linear;
  display: block;
  content: '\2744';
}

.flake:nth-child(2) {
  transform: scale(1.2) translate(.6em, 1.3em);
}

.flake:nth-child(2):after {
  z-index: 2;
  color: $color-accent;
  position: absolute;
  display: block;
  content: '\2744';
  animation: spin 3s infinite linear;
}

.flake:nth-child(3) {
  transform: scale(1.4) translate(1.2em, .6em);
}

.flake:nth-child(3):after {
  z-index: 2;
  color: $color-accent;
  position: absolute;
  animation: spin 5s infinite linear;
  display: block;
  content: '\2744';
}

.extreme {
  margin: auto auto;
  transform:rotate(-10deg);
}
.harsh-wind {
  margin: .2em auto;
}

.harsh-wind:nth-child(1) {
  background: $color-accent;
  border-radius: .15em;
  width: 4em;
  height: .3em;
  animation: harsh-wind 1s infinite linear;
}

.harsh-wind:nth-child(2) {
  background: $color-accent;
  border-radius: .15em;
  width: 3em;
  height: .3em;
  animation: harsh-wind 1s infinite linear .2s forwards;
}

.harsh-wind:nth-child(3) {
  background: $color-accent;
  border-radius: .15em;
  width: 2em;
  height: .3em;
  transform: translate(1em, 0em);
  animation: harsh-wind 1s infinite linear .4s forwards;
}

.harsh-wind:nth-child(4) {
  background: $color-accent;
  border-radius: .15em;
  width: 1.5em;
  height: .3em;
  animation: harsh-wind 1s infinite linear .6s forwards;
}

.harsh-wind:nth-child(5) {
  background: $color-accent;
  border-radius: .15em;
  width: 1em;
  height: .3em;
  animation: harsh-wind 1s infinite linear .8s forwards;
}

.harsh-wind:nth-child(6) {
  background: $color-accent;
  border-radius: .15em;
  width: .75em;
  height: .3em;
  animation: harsh-wind 1s infinite linear 1s forwards;
}

.harsh-wind:nth-child(7) {
  background: $color-accent;
  border-radius: .15em;
  width: .5em;
  height: .3em;
  animation: harsh-wind 1s infinite linear 1.2s forwards;
}


/*
.thunder:after {
  z-index: 2;
  position: absolute;
  color: $color-accent;
  content: '⚡';
  transform: rotate(-25deg) translate(0.5em, 1em) scale(4);
  animation: lightning 5s infinite linear;
}


.bolt:after {
  z-index: 2;
  position: absolute;
  color: $color-accent;
  content: '⚡';
  transform: rotate(-25deg) translate(1.2em, 2em) scale(2.2);
  animation: lightning 2s infinite ease-in;
}
*/

.bolt {
  z-index: 1;
  position: absolute;
  background: $color-accent;
  width: 2.5em;
  height: 2em;
  transform: translate(-.10em, .2em) rotate(-45deg) scale(-.8) skewX(-30deg);
  color: $color-accent;
  animation: lightning 5s infinite linear;
}

.bolt:before {
  content: '';
  z-index: 2;
  display: block;
  position: absolute;
  background: $bg-color;
  width: 1.3em;
  height: 1.3em;
  color: $color-accent;
  transform: translate(1.85em, .3em) rotate(45deg);
}

.bolt:after {
  content: '';
  position: absolute;
  display: block;
  z-index: 2;
  background: $bg-color;
  width: 1.3em;
  height: 1.3em;
  transform: translate(-.65em, .3em) rotate(45deg);
}

.bolt:nth-child(2) {
  transform: translate(.75em, 1.2em) scale(-.3) rotate(-45deg) skewX(-30deg);
  animation: lightning 2s infinite linear;
}

@keyframes harsh-wind {
  0% {
    transform: translate(-.15em, 0em);
  }
  50% {
    transform: translate(.15em, 0em);
  }
    100% {
      transform: translate(-.15em, 0em);
    }
  }

  @keyframes spin {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }
  @keyframes spin-0 {
    100% {
      transform: rotate(360deg);
    }
  }
  @keyframes spin-45 {
    100% {
      transform: rotate(405deg);
    }
  }
  @keyframes spin-90 {
    100% {
      transform: rotate(450deg);
    }
  }
  @keyframes spin-135 {
    100% {
      transform: rotate(495deg);
    }
  }
  @keyframes drizzle {
    0% {
      background-color: $bg-color-light;
      box-shadow: .4em .4em $bg-color-light, .8em 0em $bg-color-light, 1.2em .4em $bg-color-light, 1.6em 0em $bg-color-light, 2em .4em $bg-color-light, .8em .8em $bg-color-light, 1.2em .4em $bg-color-light, 1.6em .8em $bg-color-light, .4em 1.2em $bg-color-light, 1.2em 1.2em $bg-color-light, .8em 1.6em $bg-color-light;
    }
    40% {
      background-color: $color-accent;
      box-shadow: .4em .4em $color-accent, .8em 0em $color-accent, 1.2em .4em $color-accent, 1.6em 0em $color-accent, 2em .4em $color-accent, .8em .8em $bg-color-light, 1.2em .4em $bg-color-light, 1.6em .8em $bg-color-light, .4em 1.2em $bg-color-light, 1.2em 1.2em $bg-color-light, .8em 1.6em $bg-color-light;
    }
    60% {
      background-color: $bg-color-light;
      box-shadow: .4em .4em $bg-color-light, .8em 0em $bg-color-light, 1.2em .4em $bg-color-light, 1.6em 0em $bg-color-light, 2em .4em $bg-color-light, .8em .8em $color-accent, 1.2em .4em $color-accent, 1.6em .8em $color-accent, .4em 1.2em $bg-color-light, 1.2em 1.2em $bg-color-light, .8em 1.6em $bg-color-light;
    }
    80% {
      background-color: $bg-color-light;
      box-shadow: .4em .4em $bg-color-light, .8em 0em $bg-color-light, 1.2em .4em $bg-color-light, 1.6em 0em $bg-color-light, 2em .4em $bg-color-light, .8em .8em $bg-color-light, 1.2em .4em $bg-color-light, 1.6em .8em $bg-color-light, .4em 1.2em $color-accent, 1.2em 1.2em $color-accent, .8em 1.6em $bg-color-light;
    }
    90% {
      background-color: $bg-color-light;
      box-shadow: .4em .4em $bg-color-light, .8em 0em $bg-color-light, 1.2em .4em $bg-color-light, 1.6em 0em $bg-color-light, 2em .4em $bg-color-light, .8em .8em $bg-color-light, 1.2em .4em $bg-color-light, 1.6em .8em $bg-color-light, .4em 1.2em $bg-color-light, 1.2em 1.2em $bg-color-light, .8em 1.6em $color-accent;
    }
    100% {
      background-color: $bg-color-light;
      box-shadow: .4em .4em $bg-color-light, .8em 0em $bg-color-light, 1.2em .4em $bg-color-light, 1.6em 0em $bg-color-light, 2em .4em $bg-color-light, .8em .8em $bg-color-light, 1.2em .4em $bg-color-light, 1.6em .8em $bg-color-light, .4em 1.2em $bg-color-light, 1.2em 1.2em $bg-color-light, .8em 1.6em $bg-color-light;
    }
  }
  @keyframes rain {
    0% {
      background-color: $bg-color-light;
      box-shadow: 0.6em 0.6em $bg-color-light, 1.2em -0.2em $bg-color-light, 1.2em 1.2em $bg-color-light, 1.8em 0.2em $bg-color-light;
    }
    30% {
      background-color: $color-accent;
      box-shadow: 0.6em 0.6em $bg-color-light, 1.2em -0.2em $color-accent, 1.2em 1.2em $bg-color-light, 1.8em 0.2em $bg-color-light;
    }
    50% {
      background-color: $bg-color-light;
      box-shadow: 0.6em 0.6em $color-accent, 1.2em -0.2em 0 $bg-color-light, 1.2em 1.2em $bg-color-light, 1.8em 0.2em $color-accent;
    }
    80% {
      background-color: $bg-color-light;
      box-shadow: 0.6em 0.6em $bg-color-light, 1.2em -0.2em $bg-color-light, 1.2em 1.2em $color-accent, 1.8em 0.2em $bg-color-light;
    }
    100% {
      background-color: $bg-color-light;
      box-shadow: 0.6em 0.6em $bg-color-light, 1.2em -0.2em $bg-color-light, 1.2em 1.2em $bg-color-light, 1.8em 0.2em $bg-color-light;
    }
  }
  @keyframes lightning {
    0% {
      background-color: $color-accent;
    }
    80% {
      background-color: $bg-color-light;
    }
    85% {
      background-color: $color-accent;
    }
    90% {
      background-color: $bg-color-light;
    }
    100% {
      background-color: $color-accent;
    }
  }
  @keyframes move {
    0% {
      opacity: 0;
    }
    50% {
      opacity: .5;
    }
    100% {
      transform: scale(0.5) translate(-6em, -3em);
      opacity: 0;
    }
  }
              
            
!

JS

              
                
              
            
!
999px

Console