Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

slow animation in NN6

Status
Not open for further replies.

UCENwebster

Programmer
Jun 7, 2002
18
US
Hi,
I'm having trouble with a layer animation using setTimeout() in Navigator 6. With IE5 it switches frames every 50 milliseconds, but when viewed in Netscape it slows down considerably. Does anybody know a fast function like setTimeout() that works well in Netscape6?

Thanks
Webster
 
What code it run every 50 milliseconds?

It's most likely an issue in that part as opposed to how setTimeOut() works.
 
Here's the code--it's a recursive function that causes a tiny little dot image to "bounce" horizontally next to a link. Like I said, it works fine in IE5. Do you think it has to do with parseInt()? I've heard that parseInt doesn't work well with Netscape...[sadeyes]

function dot_bounce() {
var d = MM_findObj('dot'); var dd;
if(d.rate < -5) d.rate = 5;
if(d.style) dd = d.style; else dd = d;
dd.left = parseInt(dd.left) - d.rate; d.rate -= 1; dot_t = setTimeout('dot_bounce();', 50);
}
 
Don't know if this has anthing to do with it but try putting braces around this 'if' statement:

if(d.style){dd = d.style;} else {dd = d;}


Couldn't hurt...
There's always a better way...
 
parseInt() works fine in Netscape. It could well be the Micro-Mediocre function you call in this that's causing the problems. Rather than using recursive calls, why don't you use setInterval() to just call the function after set time periods? Try the following code modified from your example instead:

function dot_bounce()
{
var d = MM_findObj('dot'), dd;

if(d.rate < -5) d.rate = 5;

if(d.style) dd = d.style;
else dd = d;

dd.left =(dd.left * 1) - d.rate;
d.rate--;
}

setInterval('dot_bounce()', 50);
 
Hey guys, thanks for your help so far, but I'm still having a heck of a time trying to get this layer animation fast enough to use. I tried using the setInterval() function instead of the setTimeout() function, but the performance did not imporve at all. I don't understand why the animation would hang so badly, even though intermediate steps are very simple, and especially since they run perfect on IE5. I feel like a lesser man because of it. Anybody who has any sort of advice, helpful or cynical, I will appreciate it with open ears.
 
Sorry UCENwebster, I thought I posted a reply, but I guess it didn't get posted.

Anyways, I wanted to ask if you could provide more or all of the code.

I would like to see how MM_findObj('dot') works and I would be interested in seeing the html for the 'dot' object.
In other words I want to be able to rebuild what you are doing on my computer.

If you could provide that it'd be great, and would give me a good starting place to go through it.
 
How bout this...go to the page itself (it's just a beta test page, no links or nuthin) and check out the source. That way you can see it in action, and see the code too.

The address is:
theuniversitycenters.ucsd.edu/commuter/commuterpage.html

You might be right about MM_findObj()---it's a premade Dreamweaver function, so it might be kinda crummy. Like I said before, though, the bouncing dot works beautifully in IE, so the function couldn't be totally f'd up, could it? Thanks for the help,

Webster [pipe]
 
I just tested the page in Mozilla 1.1b and noticed absolutely NO slowdowns.

It could be NS6 which is based on an older version of Mozilla had a bug of somekind which they've since fixed.

NS 7 will be based on Mozilla 1.0 which I would think should work ok.


I might take a look at the page in an older version of Mozilla....
 
Thanks man...unfortuneately I don't think my viewers will be web-savy enough to have upgraded to NS7 when they visit my page. Oh well--they should take their heads out of their asses anyway. Thanks for the tip
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top