Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/09/2008, 15:55
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años, 9 meses
Puntos: 834
Respuesta: Mariposas volando

Bueno, no tenía mariposas, así que usé otros bichos. Fijate si te sirve esto:
http://www.disegnocentell.com.ar/new.../mariposas.php
Este es el código:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
title></title>

</
head>

<
body>
<
div id="contenedor0" style="position:absolute; top:1px; left:1px;"><img src="1843.png" width="32" height="32" /></div>
<
div id="contenedor1" style="position:absolute; top:1px; left:1px;"><img src="1843.png" width="32" height="32" /></div>
<
div id="contenedor2" style="position:absolute; top:1px; left:1px;"><img src="1843.png" width="32" height="32" /></div>
<
div id="contenedor3" style="position:absolute; top:1px; left:1px;"><img src="1843.png" width="32" height="32" /></div>
<
div id="contenedor4" style="position:absolute; top:1px; left:1px;"><img src="1843.png" width="32" height="32" /></div>
<
div id="contenedor5" style="position:absolute; top:1px; left:1px;"><img src="1843.png" width="32" height="32" /></div>

<
script>
function 
getWindowData(){
    var 
widthViewport,heightViewport,xScroll,yScroll,widthTotal,heightTotal;
    if (
typeof window.innerWidth != 'undefined'){
        
widthViewportwindow.innerWidth-17;
        
heightViewportwindow.innerHeight-17;
    }else if(
typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth !='undefined' && document.documentElement.clientWidth != 0){
        
widthViewport=document.documentElement.clientWidth;
        
heightViewport=document.documentElement.clientHeight;
    }else{
        
widthViewportdocument.getElementsByTagName('body')[0].clientWidth;
        
heightViewport=document.getElementsByTagName('body')[0].clientHeight;
    }
    
xScroll=self.pageXOffset || (document.documentElement.scrollLeft+document.body.scrollLeft);
    
yScroll=self.pageYOffset || (document.documentElement.scrollTop+document.body.scrollTop);
    
widthTotal=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth,widthViewport);
    
heightTotal=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,heightViewport);
    return [
widthViewport,heightViewport,xScroll,yScroll,widthTotal,heightTotal];

 
var 
0.75;
var 
0.06;
setTimeout(function(){mover.call(document.getElementById('contenedor0'));},15);
setTimeout(function(){mover.call(document.getElementById('contenedor1'));},15);
setTimeout(function(){mover.call(document.getElementById('contenedor2'));},15);
setTimeout(function(){mover.call(document.getElementById('contenedor3'));},15);
setTimeout(function(){mover.call(document.getElementById('contenedor4'));},15);
setTimeout(function(){mover.call(document.getElementById('contenedor5'));},15);
function 
mover() {
    
this.velocidadx=this.velocidadx || 0;
    
this.aceleracionx=this.aceleracionx || 0;
    
this.velocidady=this.velocidady || 0;
    
this.aceleraciony=this.aceleraciony || 0;
    
this.xo=this.xo || Math.random()*(getWindowData()[0]-this.getElementsByTagName('img')[0].width-10);
    
this.yo=this.yo || Math.random()*(getWindowData()[1]-this.getElementsByTagName('img')[0].height-10);
    
this._x=this._x || parseInt(this.style.left);
    
this._ythis._y || parseInt(this.style.top);
    
this.aceleracionx this.velocidadx-k*(this._x-this.xo);
    
this.velocidadx c*this.aceleracionx;
    
this._x += this.velocidadx;
    
this.style.left=this._x+'px';
    
this.aceleraciony this.velocidady-k*(this._y-this.yo);
    
this.velocidady c*this.aceleraciony;
    
this._y += this.velocidady;
    
this.style.top=this._y+'px';
    var 
_this=this;
    if (
Math.abs(this._x-this.xo)<&& Math.abs(this._y-this.yo)<1) {
        
this.xo Math.random()*(getWindowData()[0]-_this.getElementsByTagName('img')[0].width-50);
        
this.yo Math.random()*(getWindowData()[1]-_this.getElementsByTagName('img')[0].height-50);
    }
    
setTimeout(function(){mover.call(_this);},15);
}

</script>
</body>
</html>