move
function moveBouncingImages() {
for (var layerLoop = 0; layerLoop < bouncingImages.imgCount; layerLoop++) {
if (bouncingImages.dirX[layerLoop] == 'left') {
if (bouncingImages.posX[layerLoop] > bouncingImages.speedX[layerLoop]) bouncingImages.posX[layerLoop] -= bouncingImages.speedX[layerLoop];
else {
bouncingImages.dirX[layerLoop] = 'right';
bouncingImages.posX[layerLoop] = 0;
}
}
else if (bouncingImages.dirX[layerLoop] == 'right') {
if (bouncingImages.posX[layerLoop] + bouncingImages.imgWidth < winWidth - bouncingImages.speedX[layerLoop]) bouncingImages.posX[layerLoop] += bouncingImages.speedX[layerLoop];
else {
bouncingImages.dirX[layerLoop] = 'left';
bouncingImages.posX[layerLoop] = winWidth - bouncingImages.imgWidth;
}
}
if (bouncingImages.dirY[layerLoop] == 'up') {
if (bouncingImages.posY[layerLoop] > bouncingImages.speedY[layerLoop]) bouncingImages.posY[layerLoop] -= bouncingImages.speedY[layerLoop];
else {
bouncingImages.dirY[layerLoop] = 'down';
bouncingImages.posY[layerLoop] = 0;
}
}
else if (bouncingImages.dirY[layerLoop] == 'down') {
if (bouncingImages.posY[layerLoop] + bouncingImages.imgHeight < winHeight - bouncingImages.speedY[layerLoop]) bouncingImages.posY[layerLoop] += bouncingImages.speedY[layerLoop];
else {
bouncingImages.dirY[layerLoop] = 'up';
bouncingImages.posY[layerLoop] = winHeight - bouncingImages.imgHeight;
}
}
}
for (var layerLoop = 0; layerLoop < bouncingImages.imgCount; layerLoop++) moveLayerTo(bouncingImages['layerObj' + layerLoop],bouncingImages.posX[layerLoop] + getDocScrollLeft(),bouncingImages.posY[layerLoop] + getDocScrollTop());
window.setTimeout('moveBouncingImages()',bouncingImages.frameRate);
}