chris_angell
07-17-2002, 11:13 AM
hello, I am stuck , I had this idea, the sad thing is that I can only manage to do part of the code...
what I would like to do is, when your mouse pointer (x or y position) is near the image the animation gets faster.. for example when your mouse is the other side of the screen the images animation goes slow ??? does that make sense ??
here is the code I have put together for the images to rotate but I need to add some code that tracks the mouse position ? so it knows what speed to animate at
delay = 1000;
imgNumber = 0;
totalimgNumber = 2;
anim = new Array();
for (i = 0; i < totalimgNumber; i++) {
anim[i] = new Image (239, 390);
anim[i].src = 'images/_navigationarrow' + (i + 1) + '.gif';
}
function Switch() {
document.randimg.src = anim[imgNumber].src;
imgNumber++;
if(imgNumber >= totalimgNumber) imgNumber = 0;
}
any ideas anyone :) what a challange ;)
what I would like to do is, when your mouse pointer (x or y position) is near the image the animation gets faster.. for example when your mouse is the other side of the screen the images animation goes slow ??? does that make sense ??
here is the code I have put together for the images to rotate but I need to add some code that tracks the mouse position ? so it knows what speed to animate at
delay = 1000;
imgNumber = 0;
totalimgNumber = 2;
anim = new Array();
for (i = 0; i < totalimgNumber; i++) {
anim[i] = new Image (239, 390);
anim[i].src = 'images/_navigationarrow' + (i + 1) + '.gif';
}
function Switch() {
document.randimg.src = anim[imgNumber].src;
imgNumber++;
if(imgNumber >= totalimgNumber) imgNumber = 0;
}
any ideas anyone :) what a challange ;)