雪を降らせるスクリプト、でもイケてない。

なんとなく書いた。
もっとリアルにすべきだよな〜。
花火大会を企画した人は、冬は雪をテーマにしてくれないかな?
春は、桜の花びら。
秋は、紅葉の葉。

<!DOCTYPE html>
<meta charset="utf-8">
<title></title>
<style>
body {
  background : #000;
  color : #ccc;
  overflow:hidden;
}
p {
  text-shadow: 0px 0px 20px #888;
}
</style>
<body>

<script>

if ('undefined' === typeof window.requestAnimationFrame) {
  window.requestAnimationFrame =
    window.requestAnimationFrame ||
    window.webkitRequestAnimationFrame||
    window.mozRequestAnimationFrame   ||
    window.oRequestAnimationFrame     ||
    window.msRequestAnimationFrame    ||
    function (callback, that) {
      var tmpFunc = function () {
        var timestamp = +(new Date); //(new Date).getTime ();
        callback (timestamp); //callback.call (that, timestamp);
      };
      window.setTimeout (tmpFunc, Math.floor (1000/60));
    };
}


function demo () {
  var n = 100;
  var i, I;
  var p1000 = [];
  var p = document.createElement ('p');
  var t;
  
  p.appendChild (document.createTextNode ('●'));
  p.style.position = 'absolute';
  
  //depth1000
  for (i = 0; i < n; i++) {
    p1000[i] = {
      e: (t = document.body.appendChild (p.cloneNode (true))),
      x: Math.random () * 1000 |0,
      y: Math.random () * 1000 |0,
      ys: Math.pow (Math.random () * 3 , 2) + 4
    };
    t.style.opacity = Math.random ();
    t.style.fontSize = (Math.random () * 20 + 3|0) + 'px';
  }
  
  function loop () {
    var i, p;
    for (i = 0; i < n; i++) {
      p = p1000[i];
      p.y += p.ys;
      p.x += Math.random ()* 2 -1;
      if (p.y > 800) p.y = 0;
      p.e.style.top = p.y + 'px';
      p.e.style.left = p.x + 'px';
    }
    requestAnimationFrame (loop);
  }
  loop ();
}
  

demo ();

</script>