Wiki Info
Vuoi reagire a questo messaggio? Crea un account in pochi click o accedi per continuare.
Ricerca Avanzata
Answers
Se necessiti di aiuto, clicca il pulsante "Cerco Aiuto" (disponibile anche per i non iscritti).
Ultimi argomenti attivi
» Comunicazione termine servizio Arduino BT Control
Da Admin Mar Mag 10, 2022 12:55 pm

» Robot aspirapolvere per Alexa: Dreame D9
Da Admin Mar Feb 09, 2021 9:42 am

» Come costruire un robot smart con Arduino
Da Admin Mar Nov 17, 2020 12:15 pm

» TOPPS Trading Cards Match Attax Champsion League/Europa League 2020/21
Da Admin Mar Nov 10, 2020 3:21 pm

» Guida per utilizzare Arduino BT Control v1.2
Da Admin Gio Lug 09, 2020 12:01 pm

» Recensione Umidigi A3 Pro - Smartphone sotto i 100€
Da Admin Gio Apr 04, 2019 12:22 pm

» [Arduino] aiuto programma
Da Glak Mar Mar 12, 2019 9:30 am

» ERRORE NELLA COMPILAZIONE NEXTION
Da papat Mar Feb 26, 2019 7:11 am

» Comandare la Smart TV con Alexa senza broadlink (gratis)
Da Admin Mar Feb 19, 2019 4:31 pm

I postatori più attivi del mese
Nessun utente


Codici Javascript fuochi d'artificio

4 partecipanti

Andare in basso

Codici Javascript fuochi d'artificio Empty Codici Javascript fuochi d'artificio

Messaggio Da Admin Mar Set 20, 2011 6:56 pm

Codici Javascript fuochi d'artificio Mimety10
Nome: Fuochi D'artificio
Tipo: Java Script
Anteprima: Nessuna
Descrizione:
Questi fuochi d'artificio sono perfetti per i vostri siti quando c'è qualche evento da festeggiare.
Voto: Codici Javascript fuochi d'artificio Default4
Codice:

<SCRIPT TYPE="text/javascript">
/**
  * You may use this code for free on any web page provided that
  * these comment lines and the following credit remain in the code.
  * Cross Browser Fireworks from http://www.javascript-fx.com
  */
/*************************************************/
if(!window.JSFX) JSFX=new Object();
 
if(!JSFX.createLayer)
{/*** Include Library Code ***/
 
var ns4 = document.layers;
var ie4 = document.all;
JSFX.objNo=0;
 
JSFX.getObjId = function(){return "JSFX_obj" + JSFX.objNo++;};
 
JSFX.createLayer = function(theHtml)
{
   var layerId = JSFX.getObjId();
 
   document.write(ns4 ? "<LAYER  NAME='"+layerId+"'>"+theHtml+"</LAYER>" :
              "<DIV id='"+layerId+"' style='position:absolute'>"+theHtml+"</DIV>" );
 
   var el =    document.getElementById   ? document.getElementById(layerId) :
         document.all       ? document.all[layerId] :
                       document.layers[layerId];
 
   if(ns4)
      el.style=el;
 
   return el;
}
JSFX.fxLayer = function(theHtml)
{
   if(theHtml == null) return;
   this.el = JSFX.createLayer(theHtml);
}
var proto = JSFX.fxLayer.prototype
 
proto.moveTo    = function(x,y){this.el.style.left = x;this.el.style.top=y;}
proto.setBgColor = function(color) { this.el.style.backgroundColor = color; }
proto.clip      = function(x1,y1, x2,y2){ this.el.style.clip="rect("+y1+" "+x2+" "+y2+" "+x1+")"; }
if(ns4){
   proto.clip = function(x1,y1, x2,y2){
      this.el.style.clip.top    =y1;this.el.style.clip.left   =x1;
      this.el.style.clip.bottom=y2;this.el.style.clip.right   =x2;
   }
   proto.setBgColor=function(color) { this.el.bgColor = color; }
}
if(window.opera)
   proto.setBgColor = function(color) { this.el.style.color = color==null?'transparent':color; }
 
if(window.innerWidth)
{
   gX=function(){return innerWidth;};
   gY=function(){return innerHeight;};
}
else
{
   gX=function(){return document.body.clientWidth;};
   gY=function(){return document.body.clientHeight;};
}
 
/*** Example extend class ***/
JSFX.fxLayer2 = function(theHtml)
{
   this.superC = JSFX.fxLayer;
   this.superC(theHtml + "C");
}
JSFX.fxLayer2.prototype = new JSFX.fxLayer;
}/*** End Library Code ***/
 
/*************************************************/
/*** Firework Spark - extends fxLayer ***/
JSFX.FireworkSpark = function(x, y)
{
   this.superC = JSFX.fxLayer;
   this.superC("*");
 
   this.dx    = Math.random() * 4 - 2;
   this.dy   = Math.random() * 4 - 2;
   this.ay   = .09;
   this.x   = x;
   this.y   = y;
   this.type = 0;
}
JSFX.FireworkSpark.prototype = new JSFX.fxLayer;
/*** END Class FireworkSpark Constructor - start methods ***/
 
JSFX.FireworkSpark.prototype.fire0 = function()
{
   var a = Math.random() * 6.294;
   var s = Math.random() * 2;
   if(Math.random() >.6) s = 2;
   this.dx = s*Math.sin(a);
   this.dy = s*Math.cos(a) - 2;
}
JSFX.FireworkSpark.prototype.fire1 = function()
{
   var a = Math.random() * 6.294;
   var s = Math.random() * 2;
   this.dx = s*Math.sin(a);
   this.dy = s*Math.cos(a) - 2;
}
JSFX.FireworkSpark.prototype.fire2 = function()
{
   var a = Math.random() * 6.294;
   var s = 2;
   this.dx = s*Math.sin(a);
   this.dy = s*Math.cos(a) - 2;
}
JSFX.FireworkSpark.prototype.fire3 = function()
{
   var a = Math.random() * 6.294;
   var s = a - Math.random();
   this.dx = s*Math.sin(a);
   this.dy = s*Math.cos(a) - 2;
}
JSFX.FireworkSpark.prototype.fire4 = function()
{
   var a = Math.random() * 6.294;
   var s = (Math.random() > 0.5) ? 2 : 1;
   if(s==1)this.setBgColor("#FFFFFF");
   s -= Math.random()/4;
   this.dx = s*Math.sin(a);
   this.dy = s*Math.cos(a) - 2;
}
JSFX.FireworkSpark.prototype.fire = function(sx, sy, fw, cl)
{
   this.setBgColor(cl);
 
   if(fw == 1)
      this.fire1();
   else if(fw == 2)
      this.fire2();
   else if(fw == 3)
      this.fire3();
   else if(fw == 4)
      this.fire4();
   else
      this.fire0();
 
   this.x   = sx;
   this.y   = sy;
   this.moveTo(sx, sy);
}
JSFX.FireworkSpark.prototype.animate = function(step)
{
   this.dy += this.ay;
   this.x += this.dx;
   this.y += this.dy;
   this.moveTo(this.x, this.y);
}
/*** END Class FireworkSpark Methods***/
 
/*** Class Firework extends Object ***/
JSFX.Firework = function(numSparks)
{
   window[ this.id = JSFX.getObjId() ] = this;
 
   this.sparks = new Array();
   for(i=0 ; i<numSparks; i++)
   {
      this.sparks[i]=new JSFX.FireworkSpark(-10, -10);
      this.sparks[i].clip(0,0,3,3);
      this.sparks[i].setBgColor("#00FF00");
   }
   this.step = 0;
   this.timerId = -1;
   this.x = 0;
   this.y = 0;
   this.dx = 0;
   this.dy = 0;
   this.ay = 0.2;
   this.state = "OFF";
}
JSFX.Firework.prototype.explode = function()
{
   var fw = Math.floor(Math.random() * 5);
 
   for(i=0 ; i<this.sparks.length ; i++)
   {
      this.sparks[i].fire(this.x, this.y, fw, this.color);
      this.sparks[i].dx += this.dx;
      this.sparks[i].dy += this.dy;
   }
}
JSFX.Firework.prototype.getMaxDy = function()
{
   var ydiff = gY() - 30;
   var dy    = 1;
   var dist  = 0;
   var ay    = this.ay;
   while(dist<ydiff)
   {
      dist += dy;
      dy+=ay;
   }
   return -dy;
}
JSFX.Firework.prototype.animate = function()
{
 
   if(this.state=="OFF")
   {
      var colors = new Array("#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FFFFFF");
      this.color = colors[Math.floor(Math.random()*colors.length)];
 
      this.step = 0;
      this.x = gX()/2;
      this.y = gY()-10;
      this.dy = this.getMaxDy();
      this.dx = Math.random()*-8 + 4;
      this.dy += Math.random()*3;
      for(i=0 ; i<this.sparks.length ; i++)
         this.sparks[i].moveTo(-10,-10);
      this.sparks[0].setBgColor(this.color);
      this.state = "TRAVEL";
   }
   else if(this.state=="TRAVEL")
   {
      this.x += this.dx;
      this.y += this.dy;
      this.dy += this.ay;
      this.sparks[0].moveTo(this.x,this.y);
      if(this.dy > 1)
      {
         this.state="EXPLODE"
         this.explode();
      }
   }
   else
   {
      if(this.step > 40)
         this.state="OFF";
 
      this.step++;
 
      for(i=0 ; i<this.sparks.length ; i++)
         this.sparks[i].animate(this.step);
   }
 
}
JSFX.Firework.prototype.start = function()
{
   if(this.timerId == -1)
   {
      this.state = "OFF";
      this.timerId = setInterval("window."+this.id+".animate()", 30);
   }
 
}
JSFX.Firework.prototype.stop = function()
{
   if(this.timerId != -1)
   {
      clearInterval(this.timerId);
      for(i=0 ; i<this.sparks.length ; i++)
         this.sparks[i].moveTo(-10,-10);
      this.timerId = -1;
      this.step = 0;
   }
}
/*** END Class Firework***/
 
JSFX.FWStart = function()
{
   if(JSFX.FWLoad)JSFX.FWLoad();
   myFW1.start();
   myFW2.start();
}
myFW1 = new JSFX.Firework(30);
myFW2 = new JSFX.Firework(30);
JSFX.FWLoad=window.onload;
window.onload=JSFX.FWStart;
 
</SCRIPT>
Admin
Admin
♔ Amministratore

Messaggi Messaggi : 4370
Crediti Crediti : 12173
Reputazione Reputazione : 187
Data d'iscrizione Data d'iscrizione : 08.03.11
Età Età : 25

https://wikiinfo.forumattivo.it

Torna in alto Andare in basso

Codici Javascript fuochi d'artificio Empty Re: Codici Javascript fuochi d'artificio

Messaggio Da Z3R01 Lun Gen 30, 2012 8:52 pm

questo sembra proprio belle
perchè lo si può modificare per darti i fuochi di artificio ogni volta che ti si accende il pc
Z3R01
Z3R01
Livello uno
Livello uno

Messaggi Messaggi : 13
Crediti Crediti : 214
Reputazione Reputazione : 1
Data d'iscrizione Data d'iscrizione : 29.01.12

Torna in alto Andare in basso

Codici Javascript fuochi d'artificio Empty Re: Codici Javascript fuochi d'artificio

Messaggio Da Admin Lun Gen 30, 2012 9:43 pm

xD .. lol... ma è per le pagine di internet xD xD!!!!! lol!
Admin
Admin
♔ Amministratore

Messaggi Messaggi : 4370
Crediti Crediti : 12173
Reputazione Reputazione : 187
Data d'iscrizione Data d'iscrizione : 08.03.11
Età Età : 25

https://wikiinfo.forumattivo.it

Torna in alto Andare in basso

Codici Javascript fuochi d'artificio Empty Re: Codici Javascript fuochi d'artificio

Messaggio Da Draken Mar Apr 17, 2012 6:09 pm

Fitico, e veramente bello!
Draken
Draken
Livello cinque
Livello cinque

Messaggi Messaggi : 428
Crediti Crediti : 2010
Reputazione Reputazione : 36
Data d'iscrizione Data d'iscrizione : 19.03.12
Età Età : 24

Torna in alto Andare in basso

Codici Javascript fuochi d'artificio Empty Re: Codici Javascript fuochi d'artificio

Messaggio Da Taxi Mar Apr 17, 2012 7:50 pm

Concordo, questo effetto è fantastico solo che va un po fuori la finestra, ma d'altra parte, è un buon effetto grafico.

Moderazione:(Modificato il titolo dell'argomento)
Taxi
Taxi
♔ Amministratore

Messaggi Messaggi : 510
Crediti Crediti : 2223
Reputazione Reputazione : 24
Data d'iscrizione Data d'iscrizione : 08.03.11
Età Età : 34
Località Località : Milano

Torna in alto Andare in basso

Codici Javascript fuochi d'artificio Empty Re: Codici Javascript fuochi d'artificio

Messaggio Da Contenuto sponsorizzato


Contenuto sponsorizzato


Torna in alto Andare in basso

Torna in alto

- Argomenti simili

 
Permessi in questa sezione del forum:
Non puoi rispondere agli argomenti in questo forum.