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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML

              
                - raindrops=(1..200) 

%input.focus#focusDrops{:type => "radio", :name=>"focus"}
%label{:for => "focusDrops"} Focus on the raindrops

%input.focus#focusBG{:type => "radio", :name=>"focus"}
%label{:for => "focusBG"} Focus on the background 

%input.focus#focusBoth{:type => "radio", :name=>"focus", :checked => "checked"} 
%label{:for => "focusBoth"} Focus on both

%br

- (1..5).each do |i|
  - checked=i==1
  - warning=i==5?"(might be heavy)":""
  %input.image{:type => "radio", :name=>"image", :id => "image#{i}", :checked => checked}
  %label{:for => "image#{i}"} Image #{i} #{warning}


.disclaimer 
  %a{:href => "https://codepen.io/lbebber/"} By Lucas Bebber

.container
  .window <!-- As in a physical window, not a computer window-->
  .raindrops
    .borders  
      - raindrops.each do
        .border
    .drops
      - raindrops.each do
        .raindrop
              
            
!

CSS

              
                @import "compass/css3";

$images:
  'http://i64.tinypic.com/kej5n6.jpg',
  'http://i63.tinypic.com/jujtdu.jpg',
  'http://i64.tinypic.com/2vi5uu9.jpg',
  'http://i64.tinypic.com/20fz1ia.jpg',
  'http://i65.tinypic.com/15q3z8l.gif';

$width:100vw;
$height:100vh;
$raindrops:200;

body{
  background:#111;
  font-family:Helvetica, Arial, sans-serif;
  font-size:0;
}
a{
  color:inherit;
}
.container{
  width:$width;
  height:$height;
  position:absolute;
  top:0;
  left:0;
  right:0;
  bottom:0;
  margin:auto;
  overflow:hidden;
  transform:rotateY(0);
}
.window{
  background:url(nth($images,1));
  background-size:cover;
  background-position:50%;
  width:100%;
  height:100%;
  transform:rotateY(0);
  transition:-webkit-filter 600ms;
}
.raindrops{
  width:$width;
  height:$height;
  //background:transparentize(white,0.9);
  position:absolute;
  top:0;
  left:0;
  transform:rotateY(0); 
  transition:-webkit-filter 600ms;
}
.borders{
  position:absolute;
  
}
@keyframes raindrop-fall{
  0% {
    opacity:0;
    transform:rotate(180deg) scale(2.5,2.3) rotateY(0);
  }
  100% {
    opacity:1;
    transform:rotate(180deg) scale(1,1) rotateY(0); 
  }
}
$raindrop-fall-transition:10ms cubic-bezier(0.175, 0.885, 0.320, 1.275);
.raindrop{
  background:black;
  background-image:url(nth($images,1));
  background-size:$width*0.05 $height*0.05;
  position:absolute;
  border-radius:100%;
  transform:rotate(180deg) rotateY(0);
  transition:background-size 1s;
  opacity:0;
  animation:raindrop-fall $raindrop-fall-transition;
  animation-fill-mode:forwards;
}

.raindrop:hover{
  background-size:600%;
}
.border{
  position:absolute;
  box-shadow:0 0 0px 2px rgba(0,0,0,1);
  border-radius:100%;
  margin-left:2px;
  margin-top:1px;
  opacity:0;
  animation:raindrop-fall $raindrop-fall-transition;
  animation-fill-mode:forwards;
}

@for $i from 1 through $raindrops+1{
  $x:random();
  $y:random();
  $size:2+random(11); 
  $stretch:random(20)/100;
  $drop-height:$size*(1+$stretch);
  $delay:(random())*30s;
  $transition:300ms;
  .raindrop:nth-child(#{$i}){
    left:$x*$width;
    top:$y*$height;
    width:$size+px;
    height:$drop-height+px;
    background-position:#{($x*100)+"%"} #{($y*100)+"%"}; 
    animation-delay:$delay; 
  }
  .border:nth-child(#{$i}){
    left:($x*$width);
    top:($y*$height);
    $shadow-size:(($size*0.3) - 1px);
    width:($size - ($shadow-size*2));
    height:($drop-height - 0)+px;
    box-shadow:0 0 0 $shadow-size rgba(0,0,0,0.6);
    animation-delay:$delay;
  }
}
%control{
  display:none;
  &+label{
    position:relative;
    z-index:2;
    display:inline-block;
    background:#fff;
    text-transform:uppercase;
    font-size:10pt;
    height:30px;
    line-height:30px;
    padding-left:20px;
    padding-right:20px;
    cursor:pointer;
    font-weight:bold;
    transition:color 100ms;
    border-right:1px solid #ccc; 
    
    &:hover{
      color:#36518f;
    }
  }
  &:checked+label{
    color:#0088ff
  }
}
.focus{
  @extend %control;
}
.image{
  @extend %control;
  &+label{
    padding-left:22px;
    padding-right:21px;
    background:#222;
    color:white;
    border-right:1px solid #333; 
  }
}

#focusDrops:checked~.container .raindrops{
  @include filter(blur(0px) brightness(1.3));
}
#focusDrops:checked~.container .window{
  @include filter(blur(8px));
}

#focusBG:checked~.container .raindrops{
  @include filter(blur(2px) brightness(1.3));
}
#focusBG:checked~.container .window{
  @include filter(blur(0));
}


#focusBoth:checked~.container .raindrops{
  @include filter(blur(1px) brightness(1.3)); 
}
#focusBoth:checked~.container .window{
  @include filter(blur(4px));
}

@for $i from 1 through length($images){
  #image#{$i}:checked~.container .window,
  #image#{$i}:checked~.container .raindrop{
    background-image:url(nth($images,$i));
  }
}

.disclaimer{
  color:white;
  z-index:2;
  position:absolute;
  bottom:40px;
  left:20px;
  text-transform:uppercase;
  text-decoration:none;
  font-weight:bold;
  font-size:13px;
}
              
            
!

JS

              
                // CSS Raindrops by Lucas Bebber
              
            
!
999px

Console