Changing With MovingYou learned how change images and moving object in the HTML. Now, let's stick together
in order to make real animation. I want to make simple animation with arrow.
larrow = new Image(120,50);
larrow.src = "l.GIF";
rarrow = new Image(120,50);
rarrow.src = "r.GIF";
function st() {
moving = blockDiv.style
moving.xpos = parseInt(moving.left)
}
function RightMove() {
if (moving.xpos < 450) {
moving.xpos += 5
moving.left = moving.xpos
setTimeout ("animation()",1)
}
else {
ChangeImage('os',larrow);
LeftMove();
}
}
function LeftMove() {
if (moving.xpos > 20) {
moving.xpos -= 5
moving.left = moving.xpos
setTimeout ("la()",1)
}
else {
ChangeImage('os',rarrow);
RightMove();
}
}
function ChangeImage(ImageName,N) {
document.images(ImageName).src = N.src;
}
It is easy!!!!!!! |