• Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
AnonyViet - English Version
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
AnonyViet - English Version
No Result
View All Result
Home Tips

Code to Create Fireworks For New Year Decoration Website

AnonyViet by AnonyViet
February 20, 2023
in Tips
0
0
SHARES
Share on FacebookShare on Twitter

New Year’s Day is almost here, surely Webiste friends want to decorate their second home more splendidly and magically. Today I will show you how to create fireworks to create a Tet atmosphere for Webiste.

Join the channel Telegram belong to AnonyViet ? Link ?

Step 1: First you need to create a file named phohoa.js, copy the code content below (you can use notepad). Then upload to Hosting

Or you can download it from the link: https://anonyviet.com/resources/phaohoa/phaohoa.js

// <![CDATA[
var bits=80; // how many bits
var speed=33; // how fast - smaller is faster
var bangs=5; // how many can be launched simultaneously (note that using too many can slow the script down)
var colours=new Array("#03f", "#f03", "#0e0", "#93f", "#0cf", "#f93", "#f0c"); 
//                     blue    red     green   purple  cyan    orange  pink

/****************************
*      Fireworks Effect     *
*(c)2004-14 mf2fm web-design*
*  http://www.mf2fm.com/rv  *
* DON'T EDIT BELOW THIS BOX *
****************************/
var bangheight=new Array();
var intensity=new Array();
var colour=new Array();
var Xpos=new Array();
var Ypos=new Array();
var dX=new Array();
var dY=new Array();
var stars=new Array();
var decay=new Array();
var swide=1000;
var shigh=600;
var boddie;

if (typeof('addRVLoadEvent')!='function') function addRVLoadEvent(funky) {
  var oldonload=window.onload;
  if (typeof(oldonload)!='function') window.onload=funky;
  else window.onload=function() {
    if (oldonload) oldonload();
    funky();
  }
}

addRVLoadEvent(light_blue_touchpaper);

function light_blue_touchpaper() { if (document.getElementById) {
  var i;
  boddie=document.createElement("div");
  boddie.style.position="fixed";
  boddie.style.top="0px";
  boddie.style.left="0px";
  boddie.style.overflow="visible";
  boddie.style.zIndex = '9999';
  boddie.style.width="1px";
  boddie.style.height="1px";
  boddie.style.backgroundColor="transparent";
  document.body.appendChild(boddie);
  set_width();
  for (i=0; i<bangs; i++) {
    write_fire(i);
    launch(i);
    setInterval('stepthrough('+i+')', speed);
  }
}}

function write_fire(N) {
  var i, rlef, rdow;
  stars[N+'r']=createDiv('|', 12);
  boddie.appendChild(stars[N+'r']);
  for (i=bits*N; i<bits+bits*N; i++) {
    stars[i]=createDiv('*', 13);
    boddie.appendChild(stars[i]);
  }
}

function createDiv(char, size) {
  var div=document.createElement("div");
  div.style.font=size+"px monospace";
  div.style.position="absolute";
  div.style.zIndex = '9999';
  div.style.backgroundColor="transparent";
  div.appendChild(document.createTextNode(char));
  return (div);
}

function launch(N) {
  colour[N]=Math.floor(Math.random()*colours.length);
  Xpos[N+"r"]=swide*0.5;
  Ypos[N+"r"]=shigh-5;
  bangheight[N]=Math.round((0.5+Math.random())*shigh*0.4);
  dX[N+"r"]=(Math.random()-0.5)*swide/bangheight[N];
  if (dX[N+"r"]>1.25) stars[N+"r"].firstChild.nodeValue="/";
  else if (dX[N+"r"]<-1.25) stars[N+"r"].firstChild.nodeValue="\\";
  else stars[N+"r"].firstChild.nodeValue="|";
  stars[N+"r"].style.color=colours[colour[N]];
}

function bang(N) {
  var i, Z, A=0;
  for (i=bits*N; i<bits+bits*N; i++) { 
    Z=stars[i].style;
    Z.left=Xpos[i]+"px";
    Z.top=Ypos[i]+"px";
    if (decay[i]) decay[i]--;
    else A++;
    if (decay[i]==15) Z.fontSize="7px";
    else if (decay[i]==7) Z.fontSize="2px";
    else if (decay[i]==1) Z.visibility="hidden";
	if (decay[i]>1 && Math.random()<.1) {
	   Z.visibility="hidden";
	   setTimeout('stars['+i+'].style.visibility="visible"', speed-1);
	}
    Xpos[i]+=dX[i];
    Ypos[i]+=(dY[i]+=1.25/intensity[N]);

  }
  if (A!=bits) setTimeout("bang("+N+")", speed);
}

function stepthrough(N) { 
  var i, M, Z;
  var oldx=Xpos[N+"r"];
  var oldy=Ypos[N+"r"];
  Xpos[N+"r"]+=dX[N+"r"];
  Ypos[N+"r"]-=4;
  if (Ypos[N+"r"]<bangheight[N]) {
    M=Math.floor(Math.random()*3*colours.length);
    intensity[N]=5+Math.random()*4;
    for (i=N*bits; i<bits+bits*N; i++) {
      Xpos[i]=Xpos[N+"r"];
      Ypos[i]=Ypos[N+"r"];
      dY[i]=(Math.random()-0.5)*intensity[N];
      dX[i]=(Math.random()-0.5)*(intensity[N]-Math.abs(dY[i]))*1.25;
      decay[i]=16+Math.floor(Math.random()*16);
      Z=stars[i];
      if (M<colours.length) Z.style.color=colours[i%2?colour[N]:M];
      else if (M<2*colours.length) Z.style.color=colours[colour[N]];
      else Z.style.color=colours[i%colours.length];
      Z.style.fontSize="13px";
      Z.style.visibility="visible";
    }
    bang(N);
    launch(N);
  }
  stars[N+"r"].style.left=oldx+"px";
  stars[N+"r"].style.top=oldy+"px";
} 

window.onresize=set_width;
function set_width() {
  var sw_min=999999;
  var sh_min=999999;
  if (document.documentElement && document.documentElement.clientWidth) {
    if (document.documentElement.clientWidth>0) sw_min=document.documentElement.clientWidth;
    if (document.documentElement.clientHeight>0) sh_min=document.documentElement.clientHeight;
  }
  if (typeof(self.innerWidth)!="undefined" && self.innerWidth) {
    if (self.innerWidth>0 && self.innerWidth<sw_min) sw_min=self.innerWidth;
    if (self.innerHeight>0 && self.innerHeight<sh_min) sh_min=self.innerHeight;
  }
  if (document.body.clientWidth) {
    if (document.body.clientWidth>0 && document.body.clientWidth<sw_min) sw_min=document.body.clientWidth;
    if (document.body.clientHeight>0 && document.body.clientHeight<sh_min) sh_min=document.body.clientHeight;
  }
  if (sw_min==999999 || sh_min==999999) {
    sw_min=800;
    sh_min=600;
  }
  swide=sw_min;
  shigh=sh_min;
}
// ]]>

Step 2: Insert the following code below the tag Web’s

Note: src="https://websitecuaban.com/phaohoa.js"This is the path of the file hoahoa.js that you upload to the Website, remember to change the path to the correct one.

<script src="https://websitecuaban.com/phaohoa.js"></script>
<script type="text/javascript">
var bgBegin = 22;
var bgEnd = 31;
var bgTetId = 31;
var bgTetUrl="/banner/";
document.body.style.backgroundImage="url(" + bgTetUrl + bgTetId + '.jpg)';
document.body.style.backgroundAttachment="fixed";
document.body.style.backgroundSize="cover";
setInterval(function(){
	if (bgTetId == bgEnd) bgTetId = bgBegin;
	document.body.style.backgroundImage="url(" + bgTetUrl + bgTetId + '.jpg)';
	document.body.style.backgroundAttachment="fixed";
	document.body.style.backgroundSize="cover";
	bgTetId++;
}, 15000);
</script>

You can now reopen the Website and press F5 to refresh and enjoy

You can see how to make a website with flies running at this lesson

The article achieved: 5/5 – (101 votes)

Previous Post

Decorate Tet for Website with Tet couplets and pictures

Next Post

Summary of protest links to Unlock, Report Facebook

AnonyViet

AnonyViet

Related Posts

5 steps to fix 100% Full Disk error on Windows 8/8.1/10
Tips

5 steps to fix 100% Full Disk error on Windows 8/8.1/10

March 22, 2023
Bing AI – Microsoft’s smart search engine
Tips

Bing AI – Microsoft’s smart search engine

March 22, 2023
[Facebook] Summary of how to RIP FB (Nth part)
Tips

[Facebook] Summary of how to RIP FB (Nth part)

March 20, 2023
How to create a Web App Chatbot that writes code automatically in Python
Tips

How to create a Web App Chatbot that writes code automatically in Python

March 20, 2023
Turn off Facebook’s Autoplay video to save 3G
Tips

Turn off Facebook’s Autoplay video to save 3G

March 19, 2023
Instructions to create Email by domain name for free
Tips

Instructions to create Email by domain name for free

March 18, 2023
Next Post
Summary of protest links to Unlock, Report Facebook

Summary of protest links to Unlock, Report Facebook

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent News

5 steps to fix 100% Full Disk error on Windows 8/8.1/10

5 steps to fix 100% Full Disk error on Windows 8/8.1/10

March 22, 2023
TOP latest Vivo phones with enough price segments to buy

TOP latest Vivo phones with enough price segments to buy

March 22, 2023
On hand OPPO Find N2 Flip: Is the folding screen good?

On hand OPPO Find N2 Flip: Is the folding screen good?

March 22, 2023
Xiaomi Redmi Note 12 |  How much does Pro 5G cost, which phone to buy?

Xiaomi Redmi Note 12 | How much does Pro 5G cost, which phone to buy?

March 22, 2023
5 steps to fix 100% Full Disk error on Windows 8/8.1/10

5 steps to fix 100% Full Disk error on Windows 8/8.1/10

March 22, 2023
TOP latest Vivo phones with enough price segments to buy

TOP latest Vivo phones with enough price segments to buy

March 22, 2023
On hand OPPO Find N2 Flip: Is the folding screen good?

On hand OPPO Find N2 Flip: Is the folding screen good?

March 22, 2023
AnonyViet – English Version

AnonyViet

AnonyViet is a website share knowledge that you have never learned in school!

We are ready to welcome your comments, as well as your articles sent to AnonyViet.

Follow Us

Contact:

Email: anonyviet.com[@]gmail.com

Main Website: https://anonyviet.com

Recent News

5 steps to fix 100% Full Disk error on Windows 8/8.1/10

5 steps to fix 100% Full Disk error on Windows 8/8.1/10

March 22, 2023
TOP latest Vivo phones with enough price segments to buy

TOP latest Vivo phones with enough price segments to buy

March 22, 2023
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.