1.4 | Moving on Diagonals |
To move on diagonals I'll use the moveBy() method. It moves the layer vertically and horizontally at the same time. You could perform the same task by doing two separate commands one right after another, but this way it saves coding time.
function DownRight() {
document.layers["mylayer"].moveBy(20,20);
}
function DownLeft() {
document.layers["mylayer"].moveBy(-20,20);
}
function UpRight() {
document.layers["mylayer"].moveBy(20,-20);
}
function UpLeft() {
document.layers["mylayer"].moveBy(-20,-20);
}
1.1 Introduction
1.2 Overlapping 1.3 Nesting 1.4 Using JavaScript |
2.1 Sliding Layers
2.2 Pre-Built Functions 2.3 Clipping Layers 2.4 Looping Animations 2.5 Changing Images |
3.1 Mouse-Click Animation
3.2 Capturing Keystrokes 3.3 Drag and Drop 4.1 Making Demos 4.4 Problems 4.5 Screen Sizes |
|