ホームページにハートマークがうようよ!

うごめく範囲は適当。の直前に。

function FloatHearts () {
  var size = Math.pow (Math.floor ((Math.random () * 15) + 2), 2);
  var area_x = 300;
  var area_y = 300;
  var interval = Math.floor(Math.random () * 30) + 10;
  var heart = document.createElement ('p');
  var x = 0;
  var y = 0;
  var op = 0;
  var style = heart.style;
    style.position = 'absolute';
    style.float = 'left';
    style.fontSize = size + 'px';
    style.opacity = op +'';
    style.color = '#f48';
    heart.appendChild (document.createTextNode ('♥'));
    document.body.appendChild (heart);
  var sp = Math.random () /100;
  var cp = Math.random () /100;
  var so = Math.random () * Math.PI / 100;

  var loop = function () {
  x += sp;
  y += cp;
  op += so;
    style.left = area_x / 2 + Math.floor (Math.sin (x) * area_x) + 'px';
    style.top = area_y / 2 + Math.floor (Math.cos (y) * area_x) + 'px';
    style.opacity = 1 - Math.abs (Math.sin (op));
  };
  setInterval (loop, interval);
}

var i = 10;
while (i--)
  FloatHearts ();

</script>

</body>
</html>