setTimeOut vs time-based animation

B

Brainless

hi...

I've recently created a dhtml thing on http://www.shapers.nl/ that
animates a lot of images. The thing I want to solve is the lag that
occurs when a new animation is initiated.

To make it time-based I calculate the entire animation on beforehand
and create numerous setTimeOuts in a repeat loop (it's the loop that
creates the lag).
Creating an animation like this has some more disadvantages:
- it's 'difficult' to suddenly end the animation (you'd have to kill
all remaining setTimeOuts)
- setTimeOut is an inaccurate way of animating: the position of an
image might be changed twice per cycle or (the other way around) a
position could change once per two cycles

I need to code something that calculates the position of an image
every cycle. To do this I need the deltaT (= milliseconds between
cycles), and for that I need some sort of event (or workaround) that
occurs every cycle (and works both in IE and Mozilla).

I've tried calculating deltaT with a setTimeOut('getDeltaT()',1) and
with the mouseMove event but both seem slightly inaccurate since they
sometimes return deltaT=0.

anybody got a solution?

grtz...

Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top