Efecto Nieve
#1 ·

Poner alguno de estos codigos en la plantilla del blog:


Codigo1

Solo hay que cambiar URL (en: var snowflake = "URL";) por la url de la imagen que hara de copo de nieve

Codigo PHP:

<script>


var no = 15; // snow number
var speed = 15; // smaller number moves the snow faster
var snowflake = "URL";

var ns4up = (document.layers) ? 1 : 0;  // browser sniffer
var ie4up = (document.all) ? 1 : 0;
var dx, xp, yp;    // coordinate and position variables
var am, stx, sty;  // amplitude and step variables
var i, doc_width = 400, doc_height = 500;
if (ns4up) {
  doc_width = self.innerWidth;
  doc_height = self.innerHeight;
} else if (ie4up) {
  doc_width = 500;
  doc_height = 500;
}
dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();
for (i = 0; i < no; ++ i) {  
  dx = 0;                        // set coordinate variables
  xp = Math.random()*(doc_width-50);  // set position variables
  yp = Math.random()*doc_height;
  am = Math.random()*20;         // set amplitude variables
  stx = 0.02 + Math.random()/10; // set step variables
  sty = 0.7 + Math.random();     // set step variables
  if (ns4up) {                      // set layers
    if (i == 0) {
      document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
      document.write("top=\"15\" visibility=\"show\"><img src=\"");
      document.write(snowflake + "\" border=\"0\"></layer>");
    } else {
      document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
      document.write("top=\"15\" visibility=\"show\"><img src=\"");
      document.write(snowflake + "\" border=\"0\"></layer>");
    }
  } else if (ie4up) {
    if (i == 0) {
      document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
      document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
      document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");
      document.write(snowflake + "\" border=\"0\"></div>");
    } else {
      document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
      document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
      document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");
      document.write(snowflake + "\" border=\"0\"></div>");
    }
  }
}
function snowNS() {  // Netscape main animation function
  for (i = 0; i < no; ++ i) {  // iterate for every dot
    yp += sty;
    if (yp > doc_height-50) {
      xp = Math.random()*(doc_width-am-30);
      yp = 0;
      stx = 0.02 + Math.random()/10;
      sty = 0.7 + Math.random();
      doc_width = self.innerWidth;
      doc_height = self.innerHeight;
    }
    dx += stx;
    document.layers["dot"+i].top = yp;
    document.layers["dot"+i].left = xp + am*Math.sin(dx);
  }
  setTimeout("snowNS()", speed);
}

function snowIE() {  // IE main animation function
  for (i = 0; i < no; ++ i) {  // iterate for every dot
    yp += sty;
    if (yp > doc_height-50) {
      xp = Math.random()*(doc_width-am-30);
      yp = 0;
      stx = 0.02 + Math.random()/10;
      sty = 0.7 + Math.random();
      doc_width = document.body.clientWidth;
      doc_height = document.body.clientHeight;
    }
    dx += stx;
    document.all["dot"+i].style.pixelTop = yp;
    document.all["dot"+i].style.pixelLeft = xp + am*Math.sin(dx);
  }
  setTimeout("snowIE()", speed);
}

if (ns4up) {
  snowNS();
} else if (ie4up) {
  snowIE();
}
</script>





Codigo2

Cambiar: var snowsrc="gif_jpg/snow3.gif"
Codigo PHP:

<script language="JavaScript1.2">


  //Configure below to change URL path to the snow image
  var snowsrc="gif_jpg/snow3.gif"
  // Configure below to change number of snow to render
  var no = 10;

  var ns4up = (document.layers) ? 1 : 0;  // browser sniffer
  var ie4up = (document.all) ? 1 : 0;
  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var i, doc_width = 800, doc_height = 600;
  
  if (ns4up||ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = document.body.clientWidth;
    doc_height = document.body.clientHeight;
  }

  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();
  
  for (i = 0; i < no; ++ i) {  
    dx = 0;                        // set coordinate variables
    xp = Math.random()*(doc_width-50);  // set position variables
    yp = Math.random()*doc_height;
    am = Math.random()*20;         // set amplitude variables
    stx = 0.02 + Math.random()/10; // set step variables
    sty = 0.7 + Math.random();     // set step variables
    if (ns4up) {                      // set layers
      if (i == 0) {
        document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><a href=\"https://www.webcindario.com/yomaster/principal.htm/\"><img src='"+snowsrc+"' border=\"0\"></a></layer>");
      } else {
        document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src='"+snowsrc+"' border=\"0\"></layer>");
      }
    } else if (ie4up||ns6up) {
      if (i == 0) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"https://www.webcindario.com/yomaster/principal.htm\"><img src='"+snowsrc+"' border=\"0\"></a></div>");
      } else {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"></div>");
      }
    }
  }
  
  function snowNS() {  // Netscape main animation function
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp += sty;
      if (yp > doc_height-50) {
        xp = Math.random()*(doc_width-am-30);
        yp = 0;
        stx = 0.02 + Math.random()/10;
        sty = 0.7 + Math.random();
        doc_width = self.innerWidth;
        doc_height = self.innerHeight;
      }
      dx += stx;
      document.layers["dot"+i].top = yp;
      document.layers["dot"+i].left = xp + am*Math.sin(dx);
    }
    setTimeout("snowNS()", 10);
  }

  function snowIE_NS6() {  // IE and NS6 main animation function
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp += sty;
      if (yp > doc_height-50) {
        xp = Math.random()*(doc_width-am-30);
        yp = 0;
        stx = 0.02 + Math.random()/10;
        sty = 0.7 + Math.random();
        doc_width = ns6up?window.innerWidth : document.body.clientWidth;
        doc_height = ns6up?window.innerHeight : document.body.clientHeight;
      }
      dx += stx;
      if (ie4up){
      document.all["dot"+i].style.pixelTop = yp;
      document.all["dot"+i].style.pixelLeft = xp + am*Math.sin(dx);
      }
      else if (ns6up){
      document.getElementById("dot"+i).style.top=yp;
      document.getElementById("dot"+i).style.left=xp + am*Math.sin(dx);
      }   
    }
    setTimeout("snowIE_NS6()", 10);
  }

  if (ns4up) {
    snowNS();
  } else if (ie4up||ns6up) {
    snowIE_NS6();
  }

    </script>







Codigo3
Configurar desde CONFIGURATION STARTS HERE hasta CONFIGURATION ENDS HERE
Codigo PHP:

<script>
// CREDITS:
// Snowmaker
// By Peter Gehrig
// Copyright (c) 2003 Peter Gehrig. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at <a href="http://www.24fun.com" target="_blank">http://www.24fun.com</a>
// <a href='mailto:info@24fun.com'>info@24fun.com</a>
// 11/27/2003

// IMPORTANT:
// If you add this script to a script-library or script-archive
// you have to add a highly visible link to
// <a href="http://www.24fun.com" target="_blank">http://www.24fun.com</a> on the webpage
// where this script will be featured

///////////////////////////////////////////////////////////////////////////
// CONFIGURATION STARTS HERE
///////////////////////////////////////////////////////////////////////////

// Set the number of snowflakes (more than 30 - 40 not recommended)
var snowmax=35

// Set the colors for the snow. Add as many colors as you like
var snowcolor=new Array("#aaaacc","#ddddFF","#ccccDD")

// Set the fonts, that create the snowflakes. Add as many fonts as you like
var snowtype=new Array("Arial Black","Arial Narrow","Times","Comic Sans MS")

// Set the letter that creates your snowflake (recommended:*)
var snowletter="*"

// Set the speed of sinking (recommended values range from 0.3 to 2)
var sinkspeed=0.6

// Set the maximal-size of your snowflaxes
var snowmaxsize=22

// Set the minimal-size of your snowflaxes
var snowminsize=8

// Set the snowing-zone
// Set 1 for all-over-snowing, set 2 for left-side-snowing
// Set 3 for center-snowing, set 4 for right-side-snowing
var snowingzone=3

///////////////////////////////////////////////////////////////////////////
// CONFIGURATION ENDS HERE
///////////////////////////////////////////////////////////////////////////


// Do not edit below this line
var snow=new Array()
var marginbottom
var marginright
var timer
var i_snow=0
var x_mv=new Array();
var crds=new Array();
var lftrght=new Array();
var browserinfos=navigator.userAgent
var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var ns6=document.getElementById&&!document.all
var opera=browserinfos.match(/Opera/)  
var browserok=ie5||ns6||opera

function randommaker(range) {        
    rand=Math.floor(range*Math.random())
    return rand
}

function initsnow() {
    if (ie5 || opera) {
        marginbottom = document.body.clientHeight
        marginright = document.body.clientWidth
    }
    else if (ns6) {
        marginbottom = window.innerHeight
        marginright = window.innerWidth
    }
    var snowsizerange=snowmaxsize-snowminsize
    for (i=0;i<=snowmax;i++) {
        crds = 0;                      
        lftrght = Math.random()*15;         
        x_mv = 0.03 + Math.random()/10;
        snow=document.getElementById("s"+i)
        snow.style.fontFamily=snowtype[randommaker(snowtype.length)]
        snow.size=randommaker(snowsizerange)+snowminsize
        snow.style.fontSize=snow.size
        snow.style.color=snowcolor[randommaker(snowcolor.length)]
        snow.sink=sinkspeed*snow.size/5
        if (snowingzone==1) {snow.posx=randommaker(marginright-snow.size)}
        if (snowingzone==2) {snow.posx=randommaker(marginright/2-snow.size)}
        if (snowingzone==3) {snow.posx=randommaker(marginright/2-snow.size)+marginright/4}
        if (snowingzone==4) {snow.posx=randommaker(marginright/2-snow.size)+marginright/2}
        snow.posy=randommaker(2*marginbottom-marginbottom-2*snow.size)
        snow.style.left=snow.posx
        snow.style.top=snow.posy
    }
    movesnow()
}

function movesnow() {
    for (i=0;i<=snowmax;i++) {
        crds += x_mv;
        snow.posy+=snow.sink
        snow.style.left=snow.posx+lftrght*Math.sin(crds);
        snow.style.top=snow.posy
        
        if (snow.posy>=marginbottom-2*snow.size || parseInt(snow.style.left)>(marginright-3*lftrght)){
            if (snowingzone==1) {snow.posx=randommaker(marginright-snow.size)}
            if (snowingzone==2) {snow.posx=randommaker(marginright/2-snow.size)}
            if (snowingzone==3) {snow.posx=randommaker(marginright/2-snow.size)+marginright/4}
            if (snowingzone==4) {snow.posx=randommaker(marginright/2-snow.size)+marginright/2}
            snow.posy=0
        }
    }
    var timer=setTimeout("movesnow()",50)
}

for (i=0;i<=snowmax;i++) {
    document.write("<span id='s"+i+"' style='position:absolute;top:-"+snowmaxsize+"'>"+snowletter+"</span>")
}
if (browserok) {
    window.onload=initsnow
}
</script>





3º Cambiar: var snowflake = "dot.gif";
Codigo PHP:

<script>
<!-- Mas trucos y scripts en <a href="http://www.javascript.com.mx" target="_blank">http://www.javascript.com.mx</a> -->

var no = 15; // snow number
var speed = 15; // smaller number moves the snow faster
var snowflake = "dot.gif";

var ns4up = (document.layers) ? 1 : 0;  // browser sniffer
var ie4up = (document.all) ? 1 : 0;
var dx, xp, yp;    // coordinate and position variables
var am, stx, sty;  // amplitude and step variables
var i, doc_width = 400, doc_height = 500;
if (ns4up) {
  doc_width = self.innerWidth;
  doc_height = self.innerHeight;
} else if (ie4up) {
  doc_width = 500;
  doc_height = 500;
}
dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();
for (i = 0; i < no; ++ i) {  
  dx = 0;                        // set coordinate variables
  xp = Math.random()*(doc_width-50);  // set position variables
  yp = Math.random()*doc_height;
  am = Math.random()*20;         // set amplitude variables
  stx = 0.02 + Math.random()/10; // set step variables
  sty = 0.7 + Math.random();     // set step variables
  if (ns4up) {                      // set layers
    if (i == 0) {
      document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
      document.write("top=\"15\" visibility=\"show\"><img src=\"");
      document.write(snowflake + "\" border=\"0\"></layer>");
    } else {
      document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
      document.write("top=\"15\" visibility=\"show\"><img src=\"");
      document.write(snowflake + "\" border=\"0\"></layer>");
    }
  } else if (ie4up) {
    if (i == 0) {
      document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
      document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
      document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");
      document.write(snowflake + "\" border=\"0\"></div>");
    } else {
      document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
      document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
      document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");
      document.write(snowflake + "\" border=\"0\"></div>");
    }
  }
}
function snowNS() {  // Netscape main animation function
  for (i = 0; i < no; ++ i) {  // iterate for every dot
    yp += sty;
    if (yp > doc_height-50) {
      xp = Math.random()*(doc_width-am-30);
      yp = 0;
      stx = 0.02 + Math.random()/10;
      sty = 0.7 + Math.random();
      doc_width = self.innerWidth;
      doc_height = self.innerHeight;
    }
    dx += stx;
    document.layers["dot"+i].top = yp;
    document.layers["dot"+i].left = xp + am*Math.sin(dx);
  }
  setTimeout("snowNS()", speed);
}

function snowIE() {  // IE main animation function
  for (i = 0; i < no; ++ i) {  // iterate for every dot
    yp += sty;
    if (yp > doc_height-50) {
      xp = Math.random()*(doc_width-am-30);
      yp = 0;
      stx = 0.02 + Math.random()/10;
      sty = 0.7 + Math.random();
      doc_width = document.body.clientWidth;
      doc_height = document.body.clientHeight;
    }
    dx += stx;
    document.all["dot"+i].style.pixelTop = yp;
    document.all["dot"+i].style.pixelLeft = xp + am*Math.sin(dx);
  }
  setTimeout("snowIE()", speed);
}

if (ns4up) {
  snowNS();
} else if (ie4up) {
  snowIE();
}
</script>






Codigo4

Hay que cambiar: snowsrc="http://www.elseptimoarte.net/html/images/snow4.gif"

Codigo PHP:

<script type="text/javascript">

/******************************************
* Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
* Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
* Last updated Nov 9th, 05' by DD. This notice must stay intact for use
******************************************/
  
  //Configure below to change URL path to the snow image
  var snowsrc="http://www.elseptimoarte.net/html/images/snow4.gif"
  // Configure below to change number of snow to render
  var no = 5;
  // Configure whether snow should disappear after x seconds (0=never):
  var hidesnowtime = 0;
  // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  var snowdistance = "windowheight";

///////////Stop Config//////////////////////////////////

  var ie4up = (document.all) ? 1 : 0;
  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

    function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }

  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var i, doc_width = 800, doc_height = 600;
  
  if (ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = iecompattest().clientWidth;
    doc_height = iecompattest().clientHeight;
  }

  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();
  snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "snow4.gif" : snowsrc
  for (i = 0; i < no; ++ i) {  
    dx = 0;                        // set coordinate variables
    xp = Math.random()*(doc_width-50);  // set position variables
    yp = Math.random()*doc_height;
    am = Math.random()*20;         // set amplitude variables
    stx = 0.02 + Math.random()/10; // set step variables
    sty = 0.7 + Math.random();     // set step variables
        if (ie4up||ns6up) {
      if (i == 0) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='"+snowsrc+"' border=\"0\"></a></div>");
      } else {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"></div>");
      }
    }
  }

  function snowIE_NS6() {  // IE and NS6 main animation function
    doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
        doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp += sty;
      if (yp > doc_height-50) {
        xp = Math.random()*(doc_width-am-30);
        yp = 0;
        stx = 0.02 + Math.random()/10;
        sty = 0.7 + Math.random();
      }
      dx += stx;
      document.getElementById("dot"+i).style.top=yp+"px";
      document.getElementById("dot"+i).style.left=xp + am*Math.sin(dx)+"px";  
    }
    snowtimer=setTimeout("snowIE_NS6()", 10);
  }

    function hidesnow(){
        if (window.snowtimer) clearTimeout(snowtimer)
        for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
    }
        

if (ie4up||ns6up){
    snowIE_NS6();
        if (hidesnowtime>0)
        setTimeout("hidesnow()", hidesnowtime*1000)
        }

</script>


Colega ;)
Colega ;)
Haz clic para ver el perfil del usuario
Mensajes: 3.779
Desde: 20/May/2003
· ·
ATENCIÓN: Este tema no tiene actividad desde hace más de 6 MESES,
te recomendamos abrir un nuevo tema en lugar de responder al actual
Foro de soporte · Blogs · Trucos blogs
Opciones:
Versión imprimible del tema
Subscríbete a este tema
Date de baja de este tema
Ir al subforo:  
TU NO PUEDES Escribir nuevos temas en este foro
TU NO PUEDES Responder a los temas en este foro
TU NO PUEDES Editar tus propios mensajes en este foro
TU NO PUEDES Borrar tus propios mensajes en este foro
Ahora son las 04:54 UTC+02:00 DST
Temas similares
No se han encontrado temas similares
Recomendado