...

View Full Version : Image gets jammed (a bit) while moving



BarrMan
09-03-2008, 04:46 PM
Hey,
I'm trying to make a moving image inside a frame. And it works.
The only problem is, that while the images moves, it gets jammed on some parts and moves on.

I'd like the image to have a smooth motion.

Here's a link so you could see it in action:
http://www.imri-tech.net/splusw/

Here's the code:

function moveImage()
{
var p = Math.PI*2;
var st = new Date().getTime();
var dir=1;
var frq = 1/3000;
var s = 0;
var obj = $("moving_image");
window.setInterval(
function()
{
var et = new Date().getTime()-st;
var d = et*frq;
/*if(et*5000>7000)
$("moving_image").src = */
if(s==0)
obj.style.top = -100+d*100+"px";
if(s==1)
obj.style.left = -152+d*152+"px";
if(s==2)
obj.style.top = -d*100+"px";
if(s==3)
obj.style.left = -d*152+"px";
if(d>=1)
{
s++;
st = new Date().getTime();
}
if(s>3)
s=0;

},5);
}

Thanks!

Millenia
09-03-2008, 05:22 PM
Isn't it just lagging? I don't think you could fix it. Try using something like Flash for animations instead.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum