Results 1 to 10 of 10

Thread: Help With Found Fireworks Script

  1. #1
    Join Date
    Dec 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help With Found Fireworks Script

    I found this really cool fireworks script but the site where I found it has no contact info and no active forum. So here I am asking for some help configuring it. All I would like to do is restrict its behavior to an area within the window as opposed to the entire window.

    Thanks.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Could you link to the actual script, rather than a site containing many "fireworks" scripts?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Dec 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry! Here it is.

  4. #4
    Join Date
    Jan 2006
    Location
    New York
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That is just a page of a demo of it :-/

  5. #5
    Join Date
    May 2005
    Location
    Hawaii
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

  6. #6
    Join Date
    Dec 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Yugiohwiz
    That is just a page of a demo of it :-/

    Right! The idea is you look at the source behind the page.

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by cgweaver
    I found this really cool fireworks script but the site where I found it has no contact info and no active forum. So here I am asking for some help configuring it. All I would like to do is restrict its behavior to an area within the window as opposed to the entire window.

    Thanks.
    Which area? Where. What size area?

    The script sets its dimensions from the dimensions of the window, simply making those dimensions smaller will restrict it to an upper left hand corner area of the page defined by the new dimensions. Or, by putting it in an iframe, it can be placed anywhere on the page. There are probably other options but, however you restrict it, it tends to squish the images together and speed them up. This can be compensated for elsewhere in the script. Still, to know how best to advise you, I'd need to know better what kind of restricting you want to do.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Dec 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1
    Which area? Where. What size area?

    The script sets its dimensions from the dimensions of the window, simply making those dimensions smaller will restrict it to an upper left hand corner area of the page defined by the new dimensions.
    That's what I don't know how to do and would like to know how to do. I don't see how this script is getting its dimensions from the window.

    Quote Originally Posted by jscheuer1
    Or, by putting it in an iframe, it can be placed anywhere on the page. There are probably other options but, however you restrict it, it tends to squish the images together and speed them up.
    I could put it in an iFrame but I would rather put it in a Div. Would that have the same effect? I'll try it.

    Quote Originally Posted by jscheuer1
    This can be compensated for elsewhere in the script.
    Where? How? I would like to know how to adjust the speed.

    As you have no doubt surmised, I'm new to javascript syntax. I've done a lot of OOP over the past 12 years but I'm just getting started with js. Any help you can give me will be great. I need to get this site finished in a hurry.

    Thanks.

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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!
    Last edited by jscheuer1; 01-08-2006 at 04:37 AM.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Dec 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you so very much. This is great!

    My goal is to modify the script so that it adjusts its display size, speed, and number of fireworks to accommodate the size of its immediate parent, div most likely.

    Thanks again.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •