Dan's Layers Tutorial
2.3  Clipping Layers

To make an animated clipping is done the same way as sliding. Recall our command to clip a layer once:

document.layers['layer1'].clip.right += 10;

We just plug that line into a looping function and we're done.

function cliplayer() {
	if (document.layers["layer1"].clip.right < 200) {
		document.layers["layer1"].clip.right += 10;
		setTimeout("cliplayer()", 50);
	}
}

This function suffers the same problem that sliding did. I defined the end value as an absolute number, if you try and clip it again it won't do anything. But if you use the technique I showed in "All Directions" you can get around this if you need to.

Dan's Layers Tutorial
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


Copyright © 1997 Dan Steinman. All rights reserved.