JavaScript and vectors?
Posted: Thu Feb 24, 2005 1:50 pm
Hi,
Whenever I've used JavaScript to do a bit of playing with DHTML and I've wanted to move an object from A to B I've used setInterval() or setTimeout() and essentially created hundreds of frames to do it moving the object by X pixels each interval.
This is a bit slow in Moz....
What I wondered was if there was a far more efficient way to do using vectors much like Macromedia Flash does it. So instead of saying move object M by X pixels to the right every 50 millisecs and repeat 100 times, I'd say move M from A to B over 5.0 seconds.
I've searched around for this kinda thing but I don't really know what to search for. Most examples of moving things use the method I'm already using. If somebody could nudge/kick me in the right direction or tell me to forget it because it's not possible it'd be great.
I've seen things move smoothly in moz on other sites (but I can't find any now) so there must be a better way than my current method. When I do it, all the colors flicker around and it's very slow (only in moz).
Thanks for any help here
Whenever I've used JavaScript to do a bit of playing with DHTML and I've wanted to move an object from A to B I've used setInterval() or setTimeout() and essentially created hundreds of frames to do it moving the object by X pixels each interval.
This is a bit slow in Moz....
What I wondered was if there was a far more efficient way to do using vectors much like Macromedia Flash does it. So instead of saying move object M by X pixels to the right every 50 millisecs and repeat 100 times, I'd say move M from A to B over 5.0 seconds.
I've searched around for this kinda thing but I don't really know what to search for. Most examples of moving things use the method I'm already using. If somebody could nudge/kick me in the right direction or tell me to forget it because it's not possible it'd be great.
I've seen things move smoothly in moz on other sites (but I can't find any now) so there must be a better way than my current method. When I do it, all the colors flicker around and it's very slow (only in moz).
Thanks for any help here