Results 1 to 10 of 10

Thread: Autumn Leaves

  1. #1
    Join Date
    Sep 2012
    Location
    Lincoln, UK
    Posts
    20
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default Autumn Leaves

    1) Script Title: Autumn Leaves

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex3/leaves.htm

    3) Describe problem: Is it possible to slow the rate of fall please?

    Thanks

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    It depends on your intent. Changing this line will be very easy:
    Code:
    setTimeout('fall()',20);
    20=20ms, so just change that to a higher or lower number for more delay (slower) or less delay (faster).
    But note that this method will make the animation choppier if slowed too much, or might overload the processing in the browser if sped up too much.

    Getting into the slightly more complicated math, this line can also be modified:
    Code:
     Speed[i]= Math.random()*5+3;
    Changing 5 to another value will change the rate of random falling, and changing 3 to another value will change the default base/minimum speed.


    (Note: I haven't tested any of this, but if it doesn't work just let us know.)
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Sep 2012
    Location
    Lincoln, UK
    Posts
    20
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your reply drj33.

    I'd like to run this code on a forum I run, so the internet speed will vary from member to member.

    Link to my forum: http://www.wellieswheelbarrows.proboards.com/

  4. #4
    Join Date
    Sep 2012
    Location
    Lincoln, UK
    Posts
    20
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    I've been running the code on my test forum - http://testingwellies.proboards.com/

    I've just changed the setTimeout('fall()',20); from 20 to 50, which is much better - now to run it on my main forum.... keep your fingers crossed my members like it.

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    Ok, I agree that looks a little better for your site.

    The only problem is that it's now very subtly jumpy because it's now running about 20 frames per second (1000/50=20). 24 frames per second is standard for films, and 25 (Europe) to 30 (US) is standard for video/tv (which, through a complex process can actually be effectively 50-60fps). The original script is (1000/20=50) 50fps, so that's fast enough, like European TV. Basically those rates are fast enough that the eye sees it as smooth motion. Once you reach something like 15fps, it can start to look pretty choppy. Here, 20 is right on the edge.

    So-- either make it go a little faster (maybe a value of 40, making it about 24fps, like a film in a theater), or try changing that other line I showed you instead. Aside from potentially making the motion not work at all, it won't do any permanent damage to the site/script-- just save a backup in case you change something the wrong way. Use some trial and error to find what you like.

    Of course if you're happy with it at the moment, that's fine. In fact, some videos (on the internet) are presented at 15fps, and people don't mind too much, so 20fps should be fine. It just might be a little jumpy to some people.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Sep 2012
    Location
    Lincoln, UK
    Posts
    20
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your detailed and interesting reply. I've changed the value on my test forum.... how does it look to you now? Which browser are you using djr33?

    http://testingwellies.proboards.com/index.cgi

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    I think that looks pretty reasonable. I'm using Firefox 15 on a Mac. But it should render the same way on all browsers (that support the script), at least if the computer isn't too slow (or overloaded processing other things). This is just a frame-by-frame animation, so it won't look any smoother/better on a better computer, but a sluggish computer might make it look worse (although it would have to be a fairly old computer these days-- that isn't too much work for most modern machines).

    If you feel like playing with the script more, something you might try doing is creating less leaves as time increases. (It wouldn't be so difficult to add this, but it would take a lot of trial and error to get the details right.) Essentially add a decay based on time so that as time goes on fewer and fewer leaves start to fall. This just would help in the case of reading long posts, where the leaves might get annoying.

    Of course there's always the change that your users will simply find the script to be annoying (having things fall as they're using the forum), but just see what happens. It does add something aesthetic to the design, so it should be fine.

    Another option is to disable it except on the forum index, if that's what you'd like. It wouldn't be too hard to do that (just a basic IF statement I'd think-- again some trial and error).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #8
    Join Date
    Sep 2012
    Location
    Lincoln, UK
    Posts
    20
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    I know nothing about writing codes, I'm a silver surfing grandmother LOL, I just know if I put them in the right place they usually work. Some of the codes I have running do require me to add image links to them, lots of links in some cases.

    I'll just be running this code in my main header using it in my global header would give my members a headache when reading or replying to threads. Just wish it didn't run while I'm viewing my headers and footers - thankfully I don't need to access them very often.

  9. #9
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    Ok, that's fine. Well, code is something you can learn just by trial and error (especially something like this with lots of numbers-- think of each number as a gas pedal in a car, that can go slower or faster-- it'll take a while to figure out exactly what each does, but it'll change something). Just save a backup first

    Either way, that sounds fine. Good luck with it.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  10. #10
    Join Date
    Sep 2012
    Location
    Lincoln, UK
    Posts
    20
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    Trust me I back up all of the codes I have running, best to be safe than sorry.

    Thanks for your help.

Similar Threads

  1. Hover => autumn leaves?
    By harlem in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 10-06-2010, 11:03 AM
  2. autumn leaves
    By chaotic in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 11-17-2008, 08:30 PM
  3. Autumn leaves!!!!
    By Don in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 10-14-2008, 11:14 AM
  4. DD Autumn leaves script
    By ianric in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 10-05-2008, 07:49 PM
  5. Autumn leaves
    By walshy in forum JavaScript
    Replies: 3
    Last Post: 08-09-2005, 09:23 AM

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
  •