Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

ToninhoSouza

Modificar a ação de um JavaScript, como fazer?

Recommended Posts

Olá amigos, Como Faço Para inverter uma ação de Efeito Caindo para Efeito Subindo? veja o código abaixo: (tentei modificar de Falling para Rising e não funcionou)

/ ************************************************* ******************
*
* File: JSFX_Falling.js © JavaScript-FX.com
*
* Los CRIADO: 2000/05/16
*
* Autor: Roy Whittle www.Roy.Whittle.com
*           
* Objetivo: CRIAR Animação imagens "Qaeda" na Janela Do Navegador
*
* História
* Dados Versão DESCRIÇÃO
*
* 2001-03-17 2.0 convertido Paragrafo javascript-fx
* 2001-12-01 2.1 Remover a necessidade de JSFX.Sprite (Use FallingSprite Vez)
* 2001-12-01 2.2 renomeado de "Snow" e "Falling". Por Que?
* Como OS Usuários de: Não percebi Que Voce PODE EUA-lo Paragrafo Como Folhas
* Ou confete OU QUALQUÉR Outro Objeto los Queda !!!!!!
************************************************** ********************* /
/ *
 * Classe FallingSprite estende Camada
 * /
JSFX.FallingSprite = function (theHtml)
{
	// Chama o Construtor da superclasse
	this.superC = JSFX.Layer;
	this.superC (theHtml);

	this.x = Math.random () * (JSFX.Browser.getMaxX () - 65);
	this.y = -40;
	this.dx = Math.random () * 4-2;
	this.dy = Math.random () * 6 + 2;
	this.ang = 0;
	this.angStep = 0,2;
	this.amp = 10;
	this.state = "Queda";

	this.moveTo (this.x, this.y);
	this.show ();
}
JSFX.FallingSprite.prototype = new JSFX.Layer;

JSFX.FallingSprite.prototype.animate = function ()
{
	if (this.state == "OFF")
		voltar;

	this.x + = this.dx;
	this.y + = this.dy;
	this.ang + = this.angStep;

	this.moveTo (this.x + this.amp * Math.sin (this.ang), this.y);

	if ((this.x> JSFX.Browser.getMaxX () - 65)
	 || (This.x <JSFX.Browser.getMinX () - 0)
	 || (This.y> JSFX.Browser.getMaxY () - 65))
	{
		if (this.state == "Parar")
		{
			this.moveTo (-100, -100);
			this.hide ();
			this.state = "OFF";
		}
		Mais
		{
			this.x = Math.random () * (JSFX.Browser.getMaxX () - 65);
			this.y = JSFX.Browser.getMinY () - 40;
			this.dx = Math.random () * 4-2;
			this.dy = Math.random () * 6 + 2;
			this.ang = 0;
		}
	}
}
/ *** Classe FallingObj estende Objeto *** /
JSFX.FallingObj = function (numSprites, theimage, StopTime)
{
	this.id = "JSFX_FallingObj _" + ++ JSFX.FallingObj.count;
	this.sprites = new Array ();
	for (i = 0; i <numSprites; i ++)
	{
		this.sprites [i] = new JSFX.FallingSprite (theimage);
	}
	Janela [this.id] = this;
	this.animate ();

	if (stopTime)
		setTimeout ("Janela" + + this.id, stopTime * 1000 "stop ()"). .;

}
JSFX.FallingObj.count = 0;

JSFX.FallingObj.prototype.stop = function ()
{
	for (i = 0; i <this.sprites.length; i ++)
		this.sprites [i] .state = "Parar";
}

JSFX.FallingObj.prototype.animate = function ()
{
	setTimeout ("Janela" + + this.id, 40 "Animar ().") .;

	for (i = 0; i <this.sprites.length; i ++)
		this.sprites [i] .animate ();

}
/ *** FIM Classe FallingObj *** /

/ *
 * Classe de Queda de Objetos (estende um Método estático Pará de Criação de "Qaeda" Objetos
 * /
JSFX.Falling = function (n, theimage, stopTime)
{	
	myFalling = new JSFX.FallingObj (n, "<a href='http://tonygifsjavas.com.br/' target='_blank'> <img style =" border: none; "src =" http: // www .tonygifsjavas.com.br / efeitos_para_blogs / efeito_arvore_natal_caindo / arvore_ "+ theimage +" gif "/> </a>", stopTime);

	voltar myFalling;
}

Compartilhar este post


Link para o post
Compartilhar em outros sites

Não funcionou dessa forma amigo, obrigado!

 

 

up up, alguém poderia me ajudar...

Compartilhar este post


Link para o post
Compartilhar em outros sites

Olá galera, alguém ai pra dar uma ajudinha a resolver este Script, sei que tem feras aqui. obrigado!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Esse Script funciona da seguinte forma, os balões caindo na pagina de um Site, veja aqui um exemplo, da mesma forma que eles estão caindo, teria uma outra forma usando o mesmo Script para que os balões possa subir na pagina?

 

São três JS para este Efeito, sendo: JSFX_Browser.js , JSFX_Layer.js (se precisar deles colocarei aqui) e o principal que é este abaixo:

/*******************************************************************
*
* File    : JSFX_Falling.js © JavaScript-FX.com
*
* Created : 2000/05/16
*
* Author  : Roy Whittle www.Roy.Whittle.com
*           
* Purpose : To create animated "Falling" images in the browser window
*
* History
* Date         Version        Description
*
* 2001-03-17	2.0		Converted for javascript-fx
* 2001-12-01	2.1		Remove the need for JSFX.Sprite (Use FallingSprite instead)
* 2001-12-01	2.2		Renamed from "Snow" to "Falling". Why?
*					Because users didn't realize you can use it for leaves
*					or confetti or any other falling object!!!!!!
***********************************************************************/
/*
 * Class FallingSprite extends Layer
 */
JSFX.FallingSprite = function(theHtml)
{
	//Call the superclass constructor
	this.superC	= JSFX.Layer;
	this.superC(theHtml);

	this.x = Math.random() * (JSFX.Browser.getMaxX()-60);
	this.y = -40;
	this.dx = Math.random() * 4 - 2;
	this.dy = Math.random() * 6 + 2;
	this.ang = 0;
	this.angStep = .2;
	this.amp = 10;
	this.state = "FALL";

	this.moveTo(this.x,this.y);
	this.show();
}
JSFX.FallingSprite.prototype = new JSFX.Layer;

JSFX.FallingSprite.prototype.animate = function()
{
	if(this.state == "OFF")
		return;

	this.x += this.dx;
	this.y += this.dy;
	this.ang += this.angStep;

	this.moveTo(this.x + this.amp*Math.sin(this.ang), this.y);

	if( (this.x > JSFX.Browser.getMaxX()-60)
	 || (this.x < JSFX.Browser.getMinX()-0)
	 || (this.y > JSFX.Browser.getMaxY()-110) )
	{
		if(this.state == "STOPPING")
		{
			this.moveTo(-100,-100);
			this.hide();
			this.state = "OFF";
		}
		else
		{
			this.x = Math.random() * (JSFX.Browser.getMaxX()-60);
			this.y = JSFX.Browser.getMinY()-40;
			this.dx = Math.random() * 4 - 2;
			this.dy = Math.random() * 6 + 2;
			this.ang = 0;
		}
	}
}
/*** Class FallingObj extends Object ***/
JSFX.FallingObj = function(numSprites, theImage, stopTime)
{
	this.id = "JSFX_FallingObj_"+JSFX.FallingObj.count++;
	this.sprites = new Array();
	for(i=0 ; i<numSprites; i++)
	{
		this.sprites[i]=new JSFX.FallingSprite(theImage);
	}
	window[this.id]=this;
	this.animate();

	if(stopTime)
		setTimeout("window."+this.id+".stop()", stopTime*1000);

}
JSFX.FallingObj.count = 0;

JSFX.FallingObj.prototype.stop = function()
{
	for(i=0 ; i<this.sprites.length ; i++)
		this.sprites[i].state = "STOPPING";
}

JSFX.FallingObj.prototype.animate = function()
{
	setTimeout("window."+this.id+".animate()", 40);

	for(i=0 ; i<this.sprites.length ; i++)
		this.sprites[i].animate();

}
/*** END Class FallingObj ***/

/*
 * Class Falling extends Object (Static method for creating "Falling" objects
 */
JSFX.Falling = function(n, theImage, stopTime)
{	
	myFalling = new JSFX.FallingObj(n, "<a href='http://tonygifsjavas.com.br/' target='_blank'><img style='width: 40px; height: 80px; border: none;' src='http://www.tonygifsjavas.com.br/efeitos_para_blogs/efeito_baloes_caindo/balao_" + theImage + ".png'/></a>", stopTime);
	return myFalling;
}

Este abaixo vai no HTML

<script language="javascript">if (typeof document.attachEvent!='undefined') { window.attachEvent('onload',pallonciniByIole); } else { window.addEventListener('load',pallonciniByIole,false); }function pallonciniByIole() {JSFX.Falling(1,"1"); JSFX.Falling(1,"2"); JSFX.Falling(1,"3"); JSFX.Falling(1,"4"); JSFX.Falling(1,"5"); JSFX.Falling(1,"6"); JSFX.Falling(1,"7"); JSFX.Falling(1,"8"); JSFX.Falling(1,"9"); JSFX.Falling(1,"10"); }</script>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.