[thelist] help modify a JS

miinx lists at miinx.com.au
Sun Oct 20 00:58:01 CDT 2002


Le Sauvage wrote:
> In the script below, I want the object to move horizontally from the
> right side of the window instead of from the left.

Hi Kris,

You need to change your start & end param's, as you said, plus the
conditional that checks whether to move the object and the incrementer
that does the moving.  So:

> // Animation parameters
> startX = 0;
> startY = 500;
> endX = 900;
> endY = 501;
> deltaX = 1;
> deltaY = 0;
> movePeriod = 50;

becomes:

     startX = 500;
     startY = 500;
     endX = 0;
     endY = 501;
     deltaX = 1;
     deltaY = 0;
     movePeriod = 50;

and:

> // Animation code
> function movement() {
>  if(currentY >= endY || currentX >= endX) {
>   currentX = startX;
>   currentY = startY;
>   } else {
>   currentX += deltaX;
>   currentY += deltaY;
>   }
>  }

becomes:

// Animation code
function movement() {
  if(currentY <= endY || currentX <= endX) {
   currentX = startX;
   currentY = startY;
   } else {
   currentX -= deltaX;
   currentY -= deltaY;
   }
  }


That should make it work as you want in IE4+.

Good luck!

Karen
-------
Miinx Design & Development
e :: karen at miinx.com.au
p :: 0413.880.302
w :: www.miinx.com.au





More information about the thelist mailing list