Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <!DOCTYPE html>
<meta charset="utf-8">
<style>



</style>
<body onclick="myFunction()">
  <div class="fullscreen-bg ">
  <video style="display: none;" loop muted autoplay class="fullscreen-bg__video">
        <source src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/93690/berlin.mp4" type="video/mp4">
    </video>
</div>
  <div id="thing" style="background: red; height: 100px; width: 100px; position: absolute; display: none;"></div>
  	<div id="rain"></div>

<script src="//d3js.org/d3.v3.min.js"></script>
<script>

var width = Math.max(960, innerWidth),
    height = Math.max(500, innerHeight);

var x1 = width / 2,
    y1 = height / 2,
    x0 = x1,
    y0 = y1,
    i = 0,
    r = 200,
    τ = 2 * Math.PI;

var canvas = d3.select("#rain").append("canvas")
    .attr("width", width)
    .attr("height", height)
    .on("ontouchstart" in document ? "touchmove" : "mousemove", move);

var context = canvas.node().getContext("2d");
context.globalCompositeOperation = "lighter";
context.lineWidth = 2;

d3.timer(function() {
  context.clearRect(0, 0, width, height);

  var z = d3.hsl(++i % 360, 1, .5).rgb(),
      c = "rgba(" + z.r + "," + z.g + "," + z.b + ",",
      x = x0 += (x1 - x0) * .1,
      y = y0 += (y1 - y0) * .1;

  d3.select({}).transition()
      .duration(1000)
      .ease(Math.sqrt)
      .tween("circle", function() {
        return function(t) {
          context.strokeStyle = c + (1 - t) + ")";
          context.beginPath();
          context.arc(x, y, r * t, 0, τ);
          context.stroke();
        };
      });
});

function move() {
  var mouse = d3.mouse(this);
  x1 = mouse[0];
  y1 = mouse[1];
  d3.event.preventDefault();
}

</script>
              
            
!

CSS

              
                
#rain {
  position: relative;
  top: 0;
  left: 0;
  display: flex;
  width:100%;
    height: 100%;
  /*overflow:hidden;*/
  /*border: 1px solid #fff;*/
}

.fullscreen-bg {
  position: absolute;
  width: 110%;
  margin-left: -100px;
  height: 100%;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  z-index: -100;
}
@keyframes mynewmove {
  from {
    transform: scale(1) skew(0);
    border-color: rgba(62,190,155, 1);
  }

  to {
    transform: scale(2) skew(0);
  }
}

@keyframes mynewmove2 {
  from {
    transform: scale(1) skew(0);
    border-color: rgba(58,144,171, 1);
  }

  to {
    transform: scale(2) skew(0);
  }
}


              
            
!

JS

              
                function myFunction() {
$('video').fadeIn(3000);
}

setInterval(() => {
          var parent=document.getElementById('rain');

          console.log('background',   document.body.style.backgroundColor);
          var div = document.createElement("div");
          div.style.position='absolute';
          div.classList.add('drop');
          div.style.width='55px';
          div.style.height='25px';
          div.style.border="10px solid rgba(62,190,155,0)";

          div.style.borderRadius='50%';

          var top = Math.random()*100+'%';
          div.style.top=top;

          var left = Math.random()*100+'%';

          div.style.left=left;


          div.style.animation = "mynewmove 3s 1"; 

          parent.appendChild(div);
       
       
       // rain 2
                var parent=document.getElementById('rain');

          console.log('background',   document.body.style.backgroundColor);
          var div = document.createElement("div");
          div.style.position='absolute';
          div.classList.add('drop');
          div.style.width='55px';
          div.style.height='25px';
          div.style.border="thin solid rgba(58,144,171,0)";

          div.style.borderRadius='50%';

          var top = Math.random()*100+'%';
          div.style.top=top;

          var left = Math.random()*100+'%';

          div.style.left=left;


          div.style.animation = "mynewmove2 2s 1"; 

          parent.appendChild(div);

        }, 100);
              
            
!
999px

Console