PDA

View Full Version : Animation won't work.


snakedevil1
01-25-2003, 08:01 PM
I have a problem with trying to animate something.

I have an Iframe that scrolls to the specified place with the "scrollTo()" function when you click on a button. Then I tried to animate it by making a function that will kind of animate it. It sort of "eases" over where it should go. But I keep not getting what I want.

function goTo(where) {
speed = 5;
var dest=where*300;
if(current>dest) { move = dest - current; } else { if(dest>current) { move = dest - current; } }
moveThere(move);
}

function moveThere(move) {
move = move/speed;
document.content.scrollTo(move);
if(move>.25) { moveThere(move) }
}

Dest is the destination. First it will find where it wants to go, and assign it to dest. Then it subtracts the current location from the new one and divides it by the speed. Dividing it by the speed with slow down the time it takes to get to its destination. This will loop around and around until it finally reaches it's final destination.

But when I run it, it will only go like part of the way. Any idea as to why it is doing this?

You can see my website at http://www.vip3r.com. When you click on the profile button, you see the iFrame move and that's what I'm talking about.

BTW, I know my site is ugly, I've got a lot more to do to it.

ez4me2c3d
01-25-2003, 10:10 PM
try something like this...

http://rap.midco.net/ez4me2c3d/html

but instead of scrolling onMouseOver, scroll when the button is pressed.

snakedevil1
01-25-2003, 11:27 PM
That's what I want, but how would I make a sort of easing effect with it?

snakedevil1
01-26-2003, 10:17 PM
anybody?