OBJECTIVE: provide all the possibile dynamic ways to slice (clip) and/or slide a layer of an html web page onto another layer.
This is a whole family of scores of functions: each of them emulates a class.
You do not need them all: you may pick only the one(s) that you really mean to run on your actual pages:
INPUTS: for all the functions these rules apply:
id mandatory.
This argument must be the id assigned to the layer.
speed optional, defaults to 100 milliseconds.
This argument is a number representing the speed in milliseconds of the clipping animation.
amount optional, defaults to 1 (pixel).
This argument is a number and determines how many pixels must be clipped at every round of the animation.
size optional, defaults to half the width or height of the layer.
This argument is a number and affects only the slicing clippers.
onExitOptionalFunction optional, defaults to nothing.
This argument is either number zero to bypass it, or number 1 to use a built in function that upon exiting firstly makes the layer invisible and then restores its original clipping values, or a function crafted by yourself.
In this last case such function must be passed not as a string (that is, not in between quotes) but as the name of the function without the ending round brackets. If passed as such, this function crafted by yourself will be automatically invoked upon exiting the animation, and it accepts one argument - such argument will be passed to your function as the object that the method you used created upon initialization so that you can call from it all the properties such object holds as described in the next section, for instance you could craft a function like:
function myFunction(object){//an example custom function
object.setClip( object.originalClip ); //reset!
alert( object.layer.style.visibility );
} For the clippers that make a layer appear, the built in function merely returns false, because I presume that if a layer has been clipped so to make it appear rather than disappear, you do not want it to be to be set to invisible and restored to its original clip values once the process is completed.
stop1: an optional value to determine at which width to stop.
If you want to bypass this argument, please do not use zero but the Javascript keyword false
stop2: an optional value to determine at which height to stop.
If you want to bypass this argument, please do not use zero but the Javascript keyword false.
PROPERTIES:
id: it is the layer id.
layer: it is the layer node itself as an object, grabbed via getElementById.
amount: a number representing the amount that is clipped at each iteration.
size: a number, for the sliced layers, representing the size the slice must have (if the clipper clips top bottom, this size will represent a height, or if the clipper clips left right, this size will be a width).
It defaults to half the width of the layer for the slicers that slice (clip) horizontally and to half the height of the layer for the slicers that slice (clip) vertically.
speed: a number representing the milliseconds assigned to the animation speed.
originalClip: the original clip of the layer as an array of four numbers:
[top, right, bottom, left]
originalLeft: the original left position of the layer (parseFloat it before use).
originalTop: the original top position of the layer (parseFloat it before use)..
getClip: a built in function: it returns the clip values.
timer: a variable holding the timer upon which a Javascript setInterval is assigned.
stop1: an optional value to determine at which width to stop.
If you want to bypass this argument, please do not use zero but the Javascript keyword false
stop2: an optional value to determine at which height to stop.
If you want to bypass this argument, please do not use zero but the Javascript keyword false.
last: a string representing the name of the last clipper function run on it (it might be useful to know).
onExitOptionalFunction: this is a function, crafted by yourself (although there is a default one as you will see) that will be called upon exiting the animation (that is, when the ending condition is met). It can be useful if for instance upon exiting you want the layer to be set to invisible and its clipping values restored to the initial ones. By the way, the css visibility property of a layer will be automatically set to visible every time an animation starts.
RETURN: nothing.
CAVEATS: Each layer that is meant to be clipped must have an ID declared.
Upon running any of these functions onto a layer, the function will create (or recreate) a global (that is, window scoped) variable for each layer whose name will be in the shape: layerID_clipper whereas layerID will be the id assigned to the layer.
If you want to start the clipping process on a layer that is already partially clipped at the beginning of the animation, this would cause no malfunction. However, you must define this clipping starting setting within the style property of the HTML tag, and not in any external style sheet.
Your functions should not be called if your html layers are not fully parsed into the browser memory already.
Example of use, with suitable html:
<div style="position:relative;width:406px;height:206px; border:#ff0000 3px solid; background-color:#dddddd;">
Container layer (relatively positioned) 400 x 200
<div id="layerID" style="position:absolute; top:0px;left:0px; width:400px;height:200px; z-index:2; background-color:#ff3a0c; color:#000000; border:#000000 1px solid;padding:2px;"><span style="float:right; width:50px; height:200px;background-color:#0000ff;"></span>
Contained layer (absolutely positioned) for css clip animation testing.<br />
Dimensions: width 400px, height 200px
</div></div><script>/*do INCLUDE your function of choice here,in our case here would be psliceTB2 and then:*/
psliceTB2( 'layerID', 50/*speed*/, 3/*amount*/, 0/*size*/, 1/*or a function pointer*/,false,false);
</script>
Remove colorsThis text is protected by Copyright and cannot be reproduced, either in totality or in part, without the consent of the author. Also derivative works cannot be produced without the consent of the author.
Minor excerpts may be quoted as long as a clearly readable link leading to this file is put in place soon after or soon before the quotation. Only the author has the right to reproduce in its totality this work on other servers.
If the text includes external snippets, you may hide their borders (useful for codes): click here
This subscriber has snippets too: Read the snippets. Shoutbox: 103reviews: 153Visitors: 5,238 Overall visits to all the topics: 665,519 Daily average(Calculated from the website subscription day): 273.09Optional sorting commands: Normal order: click here Order by amount of visits: click here Order by most recently commented (attention: this will exclude from the returned results all the entries that have no comment): click here Order by highest amount of comments (attention: this will exclude from the returned results all the entries that have no comment): click here Order by vote (attention: this may exclude from the returned results all the entries that have no votes): click here Current order: normalShowing topics: 1, 10 Available total (with or without comments): 57
List topics by this author without this topic text: click here Other topics available for this author: click on any title below to view the complete item:
There is a max limit to the amount of comments that can be held by a page, limit above which any new comment that is inserted will determine the deletion of the older comment in the queue. The max amount of comments that can be inserted is of: 100. To perform this operation it is necessary to be Full Poster members. If you are a member, insert your Identification Number and Password in the proper fields, and then proceed:
To perform this operation it is necessary to be Full Poster members. If you are a member, insert your Identification Number and Password in the proper fields, and then proceed: