cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <h1>Nieve cayendo. CSS + JS. </h1>
<div id="capa"></div>
<footer>Para <a href="https://escss.blogspot.com/2016/07/creacion-elementos-animaciones-aleatorias.html" target="blank">EsCss</a>. </footer>
<p>
Tous<br>
Jaloux<br>
Sont des fous<br>
Que je blâme :<br>
Fi d'une flamme<br>
Qui nous ronge l'âme !<br>
Fais, mon cher, comme moi<br>
Pour braver la loi<br>
D'une amante<br>
Changeante,<br>
Chante,<br>
Bois.<br>
<span>Charles-François Panard.</span>
</p>

            
          
!
            
              body {
height: 150vh; 
background-color: #bebec0; 
background-image:
linear-gradient(transparent, #bebec0), url(https://docs.google.com/uc?id=0Bwv59jgRLbvUV3lWT0ZWZGR0Sk0); 
background-position: 0 65vw, 0 0; 
background-size: 100% 7vw, 100% auto; 
background-repeat: no-repeat; 
}
h1 {
width: 12em; 
margin: 20px auto; 
padding: .2em .15em; 
color: maroon; 
background-color: rgba(255,255,255,.3); 
text-align: center; 
border-radius: 1em; 
box-shadow: 0 0 .4em 0 rgba(255,255,255,1); 
}
#capa {
position: fixed; 
top: -10vh; left: 0; 
height: 120vh; 
width: 100vw; 
pointer-events: none; 
}
#capa .nieve { 
position: absolute; 
top: 0; left: 0; 
width: 2.2vmin; height: 2.2vmin; 
background: radial-gradient(circle, white 40%, transparent 75%); 
}
footer {
position: absolute; 
bottom: 20px; right: 10px; 
font-size:150%; 
font-weight: bold; 
padding: .2em .15em; 
color: maroon; 
background-color: rgba(255,255,255,.5); 
text-align: center; 
border-radius: 1em; 
box-shadow: 0 0 .4em 0 rgba(255,255,255,1); 
}
p {
display: block; 
margin-top: 55vw; 
text-align: center; 
font: bold 2em/1.5 cursive; 
color: black; 
}
span {
color: dimgrey;
font: bold .6em/3 serif; 
margin-left: 20%; 
}

            
          
!
            
              onload = inicia; 

var cantidadCopos = 30; 

function inicia() {
  for(c=0; c<cantidadCopos; c++) {
  copo = document.createElement("div"); 
  copo.setAttribute("class", "nieve"); 
  document.getElementById("capa").appendChild(copo); 
  }

  for(n=0; n<cantidadCopos; n++) {
  document.querySelectorAll("#capa .nieve")[n].addEventListener("transitionend", function(){caida(this)}, false); 
  //document.querySelectorAll("#capa .nieve")[n].innerHTML = n;
  }

  setTimeout(function(){
    for(c=0; c<cantidadCopos; c++) {
    elCopo = document.querySelectorAll("#capa .nieve")[c]; 
    elCopo.style.left = Math.floor(Math.random()*100)+ "vw"; 
    elCopo.style.transition = "top 15ms linear"; 
    elCopo.style.top = elCopo.style.top = "1vh"; 
    }
  }, 15);
}

function caida(T) {

  T.style.transition = "";
  T.style.top = "0"; 

  setTimeout(function(){
  T.style.transitionProperty = "left, top"; 
  T.style.transitionDelay = Math.floor(Math.random()*3000)+ "ms"; 
  T.style.transitionDuration = (Math.floor(Math.random()*15000) + 5000)+ "ms"; 
  T.style.transitionTimingFunction = "ease-in, ease-out"; 
  
  T.style.left = Math.floor(Math.random()*100)+ "vw"; 
  T.style.top = "110vh"; 
  }, 15);  
}

            
          
!
999px
Loading ..................

Console