TheCapasoneForo
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.



 
PortalPortal  ÍndiceÍndice  BuscarBuscar  Últimas imágenesÚltimas imágenes  RegistrarseRegistrarse  Conectarse  

 

 -codigo-Fuegos artificiales el tu WEB!

Ir abajo 
2 participantes
AutorMensaje
Stile
Ayudante
Ayudante
Stile


Cantidad de envíos : 95
Puntos : 55975
Reputación : 4
Fecha de inscripción : 05/02/2009
Edad : 32
Localización : Buenos Aires, La Plata

-codigo-Fuegos artificiales el tu WEB! Empty
MensajeTema: -codigo-Fuegos artificiales el tu WEB!   -codigo-Fuegos artificiales el tu WEB! Icon_minitimeMar Mar 31, 2009 7:09 am

FUEGOS ARTIFICIALES

Código:
<script type="text/javascript">
var bits=100;
var intensity=7;
var speed=20;
var colours=new Array("#03f", "#f03", "#0e0", "#93f", "#0cc", "#f93");


var dx, xpos, ypos, bangheight;
var Xpos=new Array();
var Ypos=new Array();
var dX=new Array();
var dY=new Array();
var decay=new Array();
var colour=0;
var swide=800;
var shigh=600;
function write_fire() {
var b, s;
b=document.createElement("div");
s=b.style;
s.position="absolute";
b.setAttribute("id", "bod");
document.body.appendChild(b);
set_scroll();
set_width();
b.appendChild(div("lg", 3, 4));
b.appendChild(div("tg", 2, 3));
for (var i=0; i<bits; i++) b.appendChild(div("bg"+i, 1, 1));
}
function div(id, w, h) {
var d=document.createElement("div");
d.style.position="absolute";
d.style.overflow="hidden";
d.style.width=w+"px";
d.style.height=h+"px";
d.setAttribute("id", id);
return (d);
}
function bang() {
var i, X, Y, Z, A=0;
for (i=0; i<bits; i++) {
X=Math.round(Xpos[i]);
Y=Math.round(Ypos[i]);
Z=document.getElementById("bg"+i).style;
if((X>=0)&&(X<swide)&&(Y>=0)&&(Y<shigh)) {
Z.left=X+"px";
Z.top=Y+"px";
}
if ((decay[i]-=1)>14) {
Z.width="3px";
Z.height="3px";
}
else if (decay[i]>7) {
Z.width="2px";
Z.height="2px";
}
else if (decay[i]>3) {
Z.width="1px";
Z.height="1px";
}
else if (++A) Z.visibility="hidden";
Xpos[i]+=dX[i];
Ypos[i]+=(dY[i]+=1.25/intensity);
}
if (A!=bits) setTimeout("bang()", speed);
}

function stepthrough() {
var i, Z;
var oldx=xpos;
var oldy=ypos;
xpos+=dx;
ypos-=4;
if (ypos<bangheight||xpos<0||xpos>=swide||ypos>=shigh) {
for (i=0; i<bits; i++) {
Xpos[i]=xpos;
Ypos[i]=ypos;
dY[i]=(Math.random()-0.5)*intensity;
dX[i]=(Math.random()-0.5)*(intensity-Math.abs(dY[i]))*1.25;
decay[i]=Math.floor((Math.random()*16)+16);
Z=document.getElementById("bg"+i).style;
Z.backgroundColor=colours[colour];
Z.visibility="visible";
}
bang();
launch();
}
document.getElementById("lg").style.left=xpos+"px";
document.getElementById("lg").style.top=ypos+"px";
document.getElementById("tg").style.left=oldx+"px";
document.getElementById("tg").style.top=oldy+"px";
}
function launch() {
colour=Math.floor(Math.random()*colours.length);
xpos=Math.round((0.5+Math.random())*swide*0.5);
ypos=shigh-5;
dx=(Math.random()-0.5)*4;
bangheight=Math.round((0.5+Math.random())*shigh*0.4);
document.getElementById("lg").style.backgroundColor=colours[colour];
document.getElementById("tg").style.backgroundColor=colours[colour];
}
window.onscroll=set_scroll;
function set_scroll() {
var sleft, sdown;
if (typeof(self.pageYOffset)=="number") {
sdown=self.pageYOffset;
sleft=self.pageXOffset;
}
else if (document.body.scrollTop || document.body.scrollLeft) {
sdown=document.body.scrollTop;
sleft=document.body.scrollLeft;
}
else if (document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {
sleft=document.documentElement.scrollLeft;
sdown=document.documentElement.scrollTop;
}
else {
sdown=0;
sleft=0;
}
var s=document.getElementById("bod").style;
s.top=sdown+"px";
s.left=sleft+"px";
}
window.onresize=set_width;
function set_width() {
if (typeof(self.innerWidth)=="number") {
swide=self.innerWidth;
shigh=self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientWidth) {
swide=document.documentElement.clientWidth;
shigh=document.documentElement.clientHeight;
}
else if (document.body.clientWidth) {
swide=document.body.clientWidth;
shigh=document.body.clientHeight;
}
}
window.onload=function() { if (document.getElementById) {
set_width();
write_fire();
launch();
setInterval('stepthrough()', speed);
}}
</script>

CREDITO: http://asistencia.foroactivo.com/tutoriales-f11/tutorial-fuegos-artificiales-en-el-foro-t15288.htm
Volver arriba Ir abajo
arielweb2009
Superior
Superior
arielweb2009


Cantidad de envíos : 72
Puntos : 55450
Reputación : 1
Fecha de inscripción : 28/03/2009
Edad : 28
Localización : La Serena , CHILE

-codigo-Fuegos artificiales el tu WEB! Empty
MensajeTema: Re: -codigo-Fuegos artificiales el tu WEB!   -codigo-Fuegos artificiales el tu WEB! Icon_minitimeMiér Abr 01, 2009 1:50 am

Hola ! , acabo de probar el código y es medio fome Rolling Eyes .
Pero se agradece por publicarlo en el foro !.


Salu2 !
Volver arriba Ir abajo
http://www.arielweb2009.es.tl
Stile
Ayudante
Ayudante
Stile


Cantidad de envíos : 95
Puntos : 55975
Reputación : 4
Fecha de inscripción : 05/02/2009
Edad : 32
Localización : Buenos Aires, La Plata

-codigo-Fuegos artificiales el tu WEB! Empty
MensajeTema: Re: -codigo-Fuegos artificiales el tu WEB!   -codigo-Fuegos artificiales el tu WEB! Icon_minitimeMiér Abr 01, 2009 1:54 am

si? yo no lo pobre todabia
pero q queres decir con fome?
Volver arriba Ir abajo
Contenido patrocinado





-codigo-Fuegos artificiales el tu WEB! Empty
MensajeTema: Re: -codigo-Fuegos artificiales el tu WEB!   -codigo-Fuegos artificiales el tu WEB! Icon_minitime

Volver arriba Ir abajo
 
-codigo-Fuegos artificiales el tu WEB!
Volver arriba 
Página 1 de 1.
 Temas similares
-
» -Codigo-Caja de codigo
» -Codigo-CentrarWeb
» -Codigo-Boton
» -Codigo-Mr.pulsame
» -Codigo-desplazar

Permisos de este foro:No puedes responder a temas en este foro.
TheCapasoneForo :: Zona web master :: Codigos-
Cambiar a: