OK, sounds like you want them in a division. You can do that by placing a division tag around the script:
Code:
<div style="position:absolute;left:300px;top:250px;">
script goes here
</div>
That won't do much good unless you also change the size of the display area of the fireworks. That is done here (red part added by yours truly):
Code:
if(window.innerWidth)
{
gX=function(){return innerWidth/3;};
gY=function(){return innerHeight/3;};
}
else
{
gX=function(){return document.body.clientWidth/3;};
gY=function(){return document.body.clientHeight/3;};
}
With the above additions, I've restricted the size to a third of the users window, instead of the full size of the window (the default settings). You could also use fixed dimensions:
Code:
if(window.innerWidth)
{
gX=200;
gY=300;};
}
else
{
gX=200;};
gY=300;};
}
The choice is yours. A flexible page layout can and should use the first (relative to the users window size) method. A rigid page layout will probably require the fixed method. Flexible pages are always better but, if yours isn't flexible, you will need to set the dimensions absolutely as in the second example.
Now, that takes care of 'Where?' and 'What size?". But, the smaller the display area of this script gets, the more squished together the images become and the faster they animate. The way to control the number of images is near the end of the script, this is the default line:
Code:
myFW = new JSFX.FireworkDisplay(20, "fw03", 21);
The number in red is the number of individual fireworks. The fw03 is the directory for the script's images and 21 is the number of images used to animate each individual firework. The red number is all that needs to be changed if you are using the default version of the script from the distribution zip. I found that for my purposes (the one third size display) 6 looked OK, but this will vary on different sized windows. It should be reasonable on most, though. If you are using a different size than I did or if you have different sensibilities, you will have to choose your own number. Now the last adjustment you may need to make is the speed. Adjust the number of fireworks first as, this as well as the size will affect the speed. The speed is controlled here:
Code:
this.timerId = setInterval("window."+this.id+".animate()", 40);
The higher the number the slower things will go, I liked 70 for my little experiment, 40 is the default.
That's it!
Bookmarks