SCRIPTING:

Leann Tweeden
UNIVERSAL LINEAR PATH MAKER AND MOVERS - ULMA
Procedures to automatically dispatch a layer (by ULMA) at some critical positions, either with their borders joining the window limits or surpassing them.
I include the Path Maker which creates sets of coordinates for every linear track that a moving layer should follow.
March 2002
{ @ }

The model above is Leann Tweeden
LOADS OF LEANN TWEEDEN ON THE NET


HOW TO IMPLEMENT THESE ULMA METHODS
The concise statements that enable you, by ULMA's agency, to run these complex tasks in so easy a way

The scripts I feature here
Gauguin
rely on my ULMA approach: therefore you need to load somewhere after your body tag either an external javaScript files which holds all the ULMA functions, or you have to paste all of them inline with a <script> tag soon after the tag <body> (and also after you've defined your layer): for all the detail and the ULMA codes, please refer to my ULMA [Universal Layer Management] Procedures: you can neither understand nor use these scripts if you are not using ULMA procedures.

These scripts have two main purposes: position a layer, move it.
As ULMA prescribes (please do se the file linked above if you have no clue what I'm talking about) you have to include a layer in your page (presumably by
<div style="position:absolute; top: ... ">
tags with a consistent set of css properties declared in its style property); then you declare a global var and then to initialize it as a new layerManager:
var foo;
foo=new layerManager('foo', 'layerNameHere')
foo is just a placeholder for whatever variable name you may choose, and layerNameHere the ID you assigned to your layer.
You now ready to initialize its methods (names of the methods can be seen in the active form below) as new methodManager, like for instance:
foo.toCenter=new managerMethod('foo','toCenter')


After done that, keep in mind these rules of thumb that may show to you the power of ULMA procedures for Dhtml:
  1. If you activate one of the methods initialized as new managerMethods, you can do that either by:
    • execute: foo.toCenter.execute()
      This would move the layer to the center. It appends page offsets, namely the level the user has scrolled the page to.
    • run: foo.toCenter.run()
      This would actually trigger an animation since if you call for run() on a ULMA method, it triggers a timeout (which can be closed by foo.toCenter.stop() - toCenter is just the method being used in this example, obviously). Since a timeout has been called in with run(), and since the methods add page offsets, this bears a remarkable consequence: the script keeps repositioning the layer to the center of the page (in the example case) at each timeout interation (depending on its speed), with the ensuing fact that if the user scrolls either upward or bottom ward the page, the layer would... follow the scrolling: this is called a watermark, I did not invent it: the watermark has been invented, if I am not mistaken, by Yahoo/Geocities.
    • You may wonder: what if I do not want to add the offsets, namely you want to position a layer in a precise location regardless to the level the user has scrolled the page to? very easy, you just declare foo.toCenter.noOffsets=1 prior to the call either to run or to execute:
      foo=new layerManager('foo', 'layerNameHere');
      foo.abilitate();
      foo.toCenter=new managerMethod('foo','toCenter');
      foo.toCenter.noOffsets=1;
      foo.toCenter.run();
      I call it self explicative and quite cool.
    You may have got the hint: if you need to position without the offsets, it makes more sense anyway to resort to execute(): in fact a call to run() without adding offsets, would trigger and go on with a timeout that would reposition (without you being aware of it for it would appear still) the layer continuously to... the page location it is already located at: therefore for either noOffsets positionings or positionings that are meant to be made only once (watermarked or not) a call to execute() is more appropriate in ULMA than a call to run().
  2. Take also into consideration that when you call in run(), the first iteration would happen only after the declared timeout speed has elapsed at least one time: this means that if you call run() with a timeout of 1000 milliseconds, your layer will "wait" 1000 milliseconds before beginning to move around. If you want to bypass this natural behaviour of a timeouted animation: first a call to execute(), then an immediate and consequent call to run(): another snap feature that ULMA provides. The former call (to execute) positions immediately, the latter call (to run) would go on with the animation after the timeout milliseconds have elapsed, so that the appearance of the whole would be smooth and gap less.
  3. More tricks: some of the positioning move the layer to document coordinates that may be finding you with a wish to locate the layer taking into account its border margins: that is, if you locate a layer at the center/right level of the screen (central level, but moved to gaze the right vertical bar of your screen) you may want the layer being positioned there with its right margin matching the limit of the screen, or you may want it to get its left margin matching the limit of the screen: this would make the layer invisible, but is a technique you may want to resort to when you mean, for instance, to make a layer enter in the page scene as if it were appearing from nowhere.
    In these cases you have in ULMA a property called switcher which defaults to zero:
    • foo.myMethod.switcher=0 (default, actually) would move the layer so that it is fully visible.
    • foo.myMethod.switcher=1 would move the layer completely (upon moving it that way, in some cases you won't be able to see it at all: do not argue the function didn't do its job!).
    • We also have a: foo.myMethod.switcher=2 which would move the layer in a different way: it applies only to screen corners coordinates (top-left, top-right, bottom-left, bottom-right): if set to 2, the layer would be moved so that its corresponding angle would be precisely pinpointed to match the angle it has been moved to (in the test form check the toBottomRight function and scroll the page vertically and horizontally both after it has been called: run it with execute (not with the run radio box checked, that is) and with switcher set to 2, and you will see immediately what I mean).
    • Numbers higher than 2 (for the functions dispatching to corners) would be read as 2.
    • So, instance:

      foo=new layerManager('foo', 'layerNameHere');
      foo.abilitate();

      foo.toBottomRight=new managerMethod('foo','toBottomRight')

      you might want to add another command prior to execution if you wish so, like:

      foo.toBottomRight.noOffsets=1
      foo.toBottomRight.switcher=1

      foo.toBottomRight.run()

For the explanations on the Path Maker, see details after the Test Form.

TEST ULMA MOVER & PATH MAKERS
Gauguin
execute:
run [this watermarks too]:
no offsets:
TEST the PATH MAKER

by ULMAMoverStopper(object)
Gauguin
TYPE 1 : TYPE 2 :

alternate? »
start Top: start Left:
end Top:
end Left:
no offsets: center:
Daisy Fuentes
The model above is Daisy Fuentes
LOADS OF DAISY FUENTES ON THE NET


THE PATH MAKER
How to build an array of coordinates for a linear/diagonal path that a layer should follow, and how to move the layer along such path

The pathMaker() does NOT NECESSARILY need ULMA : in fact, if you pass all the required 6 arguments, among which the argument named center passed as zero, then it would produce an array describing a segment path also without using ULMA.
Therefore, if you just want an array holding the [top,left] coordinates of all the steps included in a given segment and use such collection of coordinates later on with your own scripts, just run pathMaker with 6 arguments being sure the last one is zero, and it will just produce the array.
If you do want an alternative function that doesn't even involve ULMA and has no center argument, you can get the pathPlotter() function looking up for it in this file (click).

I feature here a Path Maker, which is a function meant to build an array whose each entry holds a top and left couple of coordinates: upon moving a layer (with an animation) it may be instructed to follow it by adding to your layer manager (if you're using ULMA: and in our case the layer Manager is variable placeholder we called foo) the new method ULMAMover:
foo.ULMAMover=new managerMethod('foo', 'ULMAMover');
and the assigning to it a path by declaring:
foo.ULMAMover.path=pathMaker(arguments...)
Whereas by arguments we mean a set of arguments as they are to be outlined later on.
To set the speed in milliseconds:
foo.ULMAMover.speed=250; //250 or whatever
When ready to run, you declare just as usual:
foo.ULMAMover.run()


Before printing the pathMaker codes, I want to instruct you on how to use it. It is conceived to hold two different sets of arguments:
  1. amount: this is the amount you want to be included between each set of coordinates in your path: that is, if you set an amount of, say, 5, each subsequent lot of coordinates would shift on (or backward) by 5: [0,0] [5,5] [10,10] ...
  2. startTop and startLeft: they are the coordinates you want your path must start with. You don't have to pass them counting in page offsets: when ULMAMover would engage the path made by pathMaker and would start making the layer follow it, ULMAMover would automatically add page offsets, with the default assumption you want an animation to be performed on the page level (that is: the page offsets) the user is currently positoned at.
  3. endTop and endLeft: would obviously be the coordinates where you want your animation to finish.
  4. center: ATTENTION! ATTENTION!: this parameter must be passed always even if you don't want its services (in such case just pass it as a zero).
    If you want its services you have to pass it as the layer ID (name). Please read once again this last point, for failing following its strict nature would imply either getting a javaScript error or to get your path being not the one you expected.
    If you set center to the layer ID, it would move the layer not fetching it by its top/lef corner, but by... its center: therefore you can now understand why if you pass center you have to pass it as the layer ID: the function has to work out the dimensions of the given layer. Makes sense, doesn't it?
    On the other hand, you set it to zero anyway, for if you don't the function would not work for it has been crafted in a particular way (see below).
So a first possible invocation of the pathMaker is:
pathMaker(5,0,0,300,350,0)
which moves 5 by 5 starting from coords [0,0] towards coords [300,350]

or, if you want to grab the layer by its center and not top corner:
pathMaker(5,0,0,300,350,'layerName')

Since you want to use ULMAMover (code later on) and you want to instruct it to follow that path, you have to make the pathMaker output to be passed as the path property of this method: so, as an example, after you have initialized a layerManager named foo, abilitated it and assigned to it the ULMAMover as a new managerMethod:
foo.ULMAMover.path=pathMaker(5,100,100,500,450,0);
//you could now activate it by simply saying:
foo.ULMAMover.run();


There is at least a second (TYPE 2) possible setting you may be wanting a path being crafted for an animation: this is when you want the layer to start moving from its current position: that is, without assigning to the pathMaker the starting position coordinates but assuming the pathMaker would argue as starting position coordinates the one the layer is currently positioned at. The pathMaker can work this out if you pass to it the parameters in the following shape/order:

amount - endTop - endLeft - layerName - center

That is, the difference is that you still pass amount, then you pass the end top and end left coordinates instead of the startTop and startLeft ones (you don't pass the start top and start left coordinates, so it means you want those coordinates to default to the current layer position).
You then pass between quotes the layerID, and again the very same as above for the center argument. Example:
foo.ULMAMover.path=pathMaker(5,500,450,'layerName',0);
//you could now activate it by simply saying:
foo.ULMAMover.run();
If you want to grab the center, just pass again as last argument the layerName in between quotes instead of zero.

You may notice that in the first case the arguments we passed were six, in this latter case they are 5. Center is still mandatory, set it to zero if you do not want the layer being grabbed by its top corner, but do pass it in both instances or the path wouldn't be generated.


The pathMaker will produce a path also for negative coordinates.

Also, the pathMaker will tailor the animation amounts for top and left coordinates, so that to accomodate the proportion between the width and height of the two segments: this means that if the amount in between the layer starting top coordinate and its end top coordinate and the amount in between the layer starting left coordinate and its end left coordinates, would produce two segments whose length is not equal, the pathMaker will be able to tailor the amount correctly!


function pathMaker(amount, startTop, startLeft, endTop, endLeft,center){
/* If using ULMA, then requires all ULMA function and DOM setup.
* Returns: array of arrays, each of 2 entries: [top,left]
* setting center argument is MANDATORY, at least set as ZERO to do nothing.
*/
//validation: detect number of arguments:
  if(pathMaker.arguments.length<5 ||
  parseFloat(amount)<=0 ||
  isNaN(parseFloat(amount))){return new Array(0)};
  if(pathMaker.arguments.length==5){
  center=endLeft;
  endLeft=startLeft;
  var layer=endTop;
  var object=eval(obj1+layer+obj2+style);
    if(!isNaN(parseFloat(layer))){return new Array(0)}
  endTop=startTop;
  var startCoords= new Array(parseFloat(object.top), parseFloat(object.left));
  startTop=startCoords[0];
  startLeft=startCoords[1];
  }
//initialize:
amount=(amount)?parseFloat(amount):1;
center=(center && typeof(center)=="object")?
center:(center && typeof(center)=="string")?
new Array( parseFloat( eval(obj1+center+obj2+getLayerW) ), parseFloat( eval(obj1+center+obj2+getLayerH) )):
new Array(0,0);
  if(center.length<2){
  center=new Array(0,0)
  };
center[0]=Math.round((center[0]/2)*10)/10;
center[1]=Math.round((center[1]/2)*10)/10;
var output=new Array(0);
var height=Math.abs(endTop-startTop);
var width=Math.abs(endLeft-startLeft);
  if(!height&&!width){
  return new Array(0)
  };
var h1=Math.round((height/amount)*10000)/10000;
var w1=Math.round((width/amount)*10000)/10000;
  //don't divide by 0:
  var div1height=(h1<=0)?0:
(Math.round((height/w1)*10000)/10000);
  var div1width=(w1<=0)?0:
(Math.round((width/h1)*10000)/10000);
var heightAmount=(h1>=w1)?amount:div1height;
var widthAmount=(w1>=h1)?amount:div1width;
  //don't divide by 0:
  var div2height=(heightAmount<=0)?0:height/heightAmount;
  var div2width=(widthAmount<=0)?0:width/widthAmount;
var limit= Math.round(Math.max( div2height,div2width )*10000)/10000;
var h=startTop;
var w=startLeft;
//first current position:
output[++output.length-1]= new Array(startTop-center[0],startLeft-center[1]);
//run:
for(var i=0;i<limit;i++){
//+ or - ?
h=(endTop>startTop)?(h+=heightAmount):(h-=heightAmount);
//exceeds endTop?
h=(h>endTop&&endTop>startTop)?endTop:
(h<endTop&&endTop<startTop)?endTop:h;
//+ or - ?
w=(endLeft>startLeft)?(w+=widthAmount):(w-=widthAmount);
//exceeds endLeft?
w=(w>endLeft&&endLeft>startLeft)?endLeft:
(w<endLeft&&endLeft<startLeft)?endLeft:w;
output[++output.length-1]= new Array((Math.round(h*10)/10)-center[0],
(Math.round(w*10)/10)-center[1]);
}
if(output.length && output.length>1 && output[output.length-1][0]==output[output.length-2][0] && output[output.length-1][1]==output[output.length-2][1] ){ output.pop(); };
return output;
/*keep this comment to reuse freely
http://www.unitedscripters.com */}

Now, your ULMAMover codex.
Just keep in mind that ULMAMover adds page offsets: this means that if the user scrolls the page while the animation is on, the layer would... follow also the page scrolling! (just use the form to test...).
So follow these rules:

for PATH made with pathMaker TYPE 1:

TYPE 1 is the pathMaker when arranged passing both coordinates sets: the set of the meant [startTop/startLeft] position coordinates and the set of the meant [endTop/endLeft] position coordinates.

Type 1 is the name by which we flag the pathMaker when we use it passing to it all its possible arguments, namely passing to it the startTop and startLeft cvoordinates as well as the EndTop and endLeft coordinates.

  1. Default behavior: adds offsets:
    foo.ULMAMover.run()
  2. Do not add offsets:
    foo.ULMAMover.noOffsets=1;
    foo.ULMAMover.run()

for PATH made with pathMaker TYPE 2:

TYPE 2 is the pathMaker when arranged passing only one coordinates set: the set of the meant [endTop/endLeft] position coordinates, thus letting the script detect on its own the current layer [top/left] position coordinates making of them the startTop/startLeft coordinates.

This typology has a great variety of possibilities, since it's the type of path that path maker generates when you do not pass the starting top and left coordinates assuming that the pathMaker would get as startTop and startLeft the current layer top and left coordinates.
There is a variety of chances depending on the fact you want watermark power or not (watermarking means that if you watermark, upon scrolling of the page the animation would follow the scrolling) and depending on the fact you want to add to your endTop/endLeft coordinates set the current page offsets or not, and last but not least depending on the fact whether you decide or not to relocate your layer to the current page offsets level (remember that relocation is a ULMA built in method meant to shift a layer from its position to the page level where the user has scrolled at -either upward or downward- preserving in the relocation process the original top/left location coordinates ratio):

  1. WATERMARK
    1. watermark plus relocating of the layer to current page level
      1. adding current page level to the endTop/endLeft coordinates
      2. without adding current page level to the endTop/endLeft coordinates
    2. watermark without relocating of the layer to current page level
      1. adding current page level to the endTop/endLeft coordinates
      2. without adding current page level to the endTop/endLeft coordinates
  2. NO WATERMARK
    1. no watermark plus relocating of the layer to current page level
      1. adding current page level to the endTop/endLeft coordinates
      2. without adding current page level to the endTop/endLeft coordinates
    2. no watermark without relocating of the layer to current page level
      1. adding current page level to the endTop/endLeft coordinates
      2. without adding current page level to the endTop/endLeft coordinates
On the whole they are 8 possibilities. It's not complicated, it's that I take into account all the possibilities, but yours is only one, depending on the animation architecture you want for your page. I do encourage you to test them using the form above, nothing could be more self-explicative than an active test.

To achieve these 8 possibilites you have to code in several different ways: here are the 8 formulas, all you have to do is to copy and paste them when you have met one of those 8 possible combinations.
Last but not least, in a couple of cases to achieve the formula settings we had to resort to type 1 approach: in any case when you see the startTop/startLeft couple included, it means that you can optionally even add a value to the current layer position: if you do not want add anything to the current layer positons, just change startTop and startLeft with zeros.
foo still the placeholder for your layerManager variable name.
Centers always set as zero if you do not mean to handle the layer movements by its center, otherwise pass it as the layerName itself in between quotes.
Anyway, if you prefer a function that can make these replacements for you, I add also some function snippets that would do the job by simply passing 4 parameters to them. It's not complex, I just provide you with a full-fledged approach taking into account whatever your preferences might be.

  • Three more arguments: rounds affects the foo.ULMAMover.rounds property: if you pass such argument, the animation will repeat the path as many times as you specified.
  • infiniteLoop affects the foo.ULMAMover.infiniteLoop property: if you pass such argument, the animation will repeat the path forever, overriding whatever value rounds might have or have not (see further on the ULMAMoverStopper subroutine if by chance you want to interrupt and abort the inifinte looping).
  • alternate affects the foo.ULMAMover.alternate property: if you pass such argument, the animation will repeat the path either forever (if you passed the infiniteLoop argument or you directly set foo.ULMAMOver.inifiniteLoop=1) or for the specified amount of times (if you passed the rounds or you directly set foo.ULMAMOver.rounds=10 - 10 or whatever...), but after completion of each iteration it will reverse the path so making a bouncing effect (without lingering on the last attained entry!).
    Feel free to test in the test form.
  • Remember that if you want an alternate bouncing behaviour, you have obviously to specify also either the amount of rounds or set an infiniteLoop.
  1. formula for case 1.1.1
    Watermark + Relocation + Add Page Offsets to End Coords

    For a function that gathers gathers all the relative commands for such a purpose, you can copy the following one: it gets executed by passing as first argument the layerManager itself (placeholder foo in our case. Note no apex, you pass the object itself, not the stringed name of it), then the amount, then endTop and endLeft.
    Centers, startTop and startLeft are entirely optional, as well as rounds and infinite parameters are (and to know what they are for, scroll to botttom of this file and read the section for the ULMAMover function); if you mean to pass centers, then you have to pass it either as zero or as a number other than zero, and the function will work out the rest. If you want to pass either the round or the infinite arguments but you do not want to set the startT and startL, pass startT and startL as zeros.
    Minimal sintax upon invoking on a layerManager variable named foo (values such as 5, 100 and 300 are just example values, you can use different values obviously):
    formula1(foo, 5, 100, 300)


  2. formula for case 1.1.2
    Watermark + Relocation + No Add Page Offsets to End Coords

    For a function that gathers gathers all the relative commands for such a purpose, you can copy the following one: it gets executed by passing as first argument the layerManager itself (placeholder foo in our case. Note no apex, you pass the object itself, not the stringed name of it), then the amount, then endTop and endLeft.
    Centers, startTop and startLeft are entirely optional, as well as rounds and infinite parameters are (and to know what they are for, scroll to botttom of this file and read the section for the ULMAMover function); if you mean to pass centers, then you have to pass it either as zero or as a number other than zero, and the function will work out the rest. If you want to pass either the round or the infinite arguments but you do not want to set the startT and startL, pass startT and startL as zeros.
    Minimal sintax upon invoking on a layerManager variable named foo (values such as 5, 100 and 300 are just example values, you can use different values obviously):
    formula2(foo, 5, 100, 300)


  3. formula for case 1.2.1
    Watermark + No Relocation + Add Page Offsets to End Coords

    For a function that gathers gathers all the relative commands for such a purpose, you can copy the following one: it gets executed by passing as first argument the layerManager itself (placeholder foo in our case. Note no apex, you pass the object itself, not the stringed name of it), then the amount, then endTop and endLeft.
    Centers, startTop and startLeft are entirely optional, as well as rounds and infinite parameters are (and to know what they are for, scroll to botttom of this file and read the section for the ULMAMover function); if you mean to pass centers, then you have to pass it either as zero or as a number other than zero, and the function will work out the rest. If you want to pass either the round or the infinite arguments but you do not want to set the startT and startL, pass startT and startL as zeros.
    Minimal sintax upon invoking on a layerManager variable named foo (values such as 5, 100 and 300 are just example values, you can use different values obviously):
    formula3(foo, 5, 100, 300)


  4. formula for case 1.2.2
    Watermark + No Relocation + No Add Page Offsets to End Coords

    For a function that gathers gathers all the relative commands for such a purpose, you can copy the following one: it gets executed by passing as first argument the layerManager itself (placeholder foo in our case. Note no apex, you pass the object itself, not the stringed name of it), then the amount, then endTop and endLeft.
    Centers, startTop and startLeft are entirely optional, as well as rounds and infinite parameters are (and to know what they are for, scroll to botttom of this file and read the section for the ULMAMover function); if you mean to pass centers, then you have to pass it either as zero or as a number other than zero, and the function will work out the rest. If you want to pass either the round or the infinite arguments but you do not want to set the startT and startL, pass startT and startL as zeros.
    Minimal sintax upon invoking on a layerManager variable named foo (values such as 5, 100 and 300 are just example values, you can use different values obviously):
    formula4(foo, 5, 100, 300)


  5. formula for case 2.1.1
    No Watermark + Relocation + Add Page Offsets to End Coords

    For a function that gathers gathers all the relative commands for such a purpose, you can copy the following one: it gets executed by passing as first argument the layerManager itself (placeholder foo in our case. Note no apex, you pass the object itself, not the stringed name of it), then the amount, then endTop and endLeft.
    Centers, startTop and startLeft are entirely optional, as well as rounds and infinite parameters are (and to know what they are for, scroll to botttom of this file and read the section for the ULMAMover function); if you mean to pass centers, then you have to pass it either as zero or as a number other than zero, and the function will work out the rest. If you want to pass either the round or the infinite arguments but you do not want to set the startT and startL, pass startT and startL as zeros.
    Minimal sintax upon invoking on a layerManager variable named foo (values such as 5, 100 and 300 are just example values, you can use different values obviously):
    formula5(foo, 5, 100, 300)


  6. formula for case 2.1.2
    No Watermark + Relocation + No Add Page Offsets to End Coords

    For a function that gathers gathers all the relative commands for such a purpose, you can copy the following one: it gets executed by passing as first argument the layerManager itself (placeholder foo in our case. Note no apex, you pass the object itself, not the stringed name of it), then the amount, then endTop and endLeft.
    Centers, startTop and startLeft are entirely optional, as well as rounds and infinite parameters are (and to know what they are for, scroll to botttom of this file and read the section for the ULMAMover function); if you mean to pass centers, then you have to pass it either as zero or as a number other than zero, and the function will work out the rest. If you want to pass either the round or the infinite arguments but you do not want to set the startT and startL, pass startT and startL as zeros.
    Minimal sintax upon invoking on a layerManager variable named foo (values such as 5, 100 and 300 are just example values, you can use different values obviously):
    formula6(foo, 5, 100, 300)


  7. formula for case 2.2.1
    No Watermark + No Relocation + Add Page Offsets to End Coords

    For a function that gathers gathers all the relative commands for such a purpose, you can copy the following one: it gets executed by passing as first argument the layerManager itself (placeholder foo in our case. Note no apex, you pass the object itself, not the stringed name of it), then the amount, then endTop and endLeft.
    Centers, startTop and startLeft are entirely optional, as well as rounds and infinite parameters are (and to know what they are for, scroll to botttom of this file and read the section for the ULMAMover function); if you mean to pass centers, then you have to pass it either as zero or as a number other than zero, and the function will work out the rest. If you want to pass either the round or the infinite arguments but you do not want to set the startT and startL, pass startT and startL as zeros.
    Minimal sintax upon invoking on a layerManager variable named foo (values such as 5, 100 and 300 are just example values, you can use different values obviously):
    formula7(foo, 5, 100, 300)


  8. formula for case 2.2.2
    No Watermark + No Relocation + No Add Page Offsets to End Coords

    For a function that gathers gathers all the relative commands for such a purpose, you can copy the following one: it gets executed by passing as first argument the layerManager itself (placeholder foo in our case. Note no apex, you pass the object itself, not the stringed name of it), then the amount, then endTop and endLeft.
    Centers, startTop and startLeft are entirely optional, as well as rounds and infinite parameters are (and to know what they are for, scroll to botttom of this file and read the section for the ULMAMover function); if you mean to pass centers, then you have to pass it either as zero or as a number other than zero, and the function will work out the rest. If you want to pass either the round or the infinite arguments but you do not want to set the startT and startL, pass startT and startL as zeros.
    Minimal sintax upon invoking on a layerManager variable named foo (values such as 5, 100 and 300 are just example values, you can use different values obviously):
    formula8(foo, 5, 100, 300)



THE ULMA MOVER
The code which can move layers following a path, either once or repeteadly, along with the supplementary codes which may help you performing a few additional tricks like stopping the moving layer prematurely.

Finally, your ULMAMover codex and its related supplementary codes. Therefore you need ULMA, the pathMaker code, and this code below.
The formula codes you pick (either in their linear statements or in their formula functions that gather the statements to avoid you make mistakes replacing the names of the variables or of the values) are entirely optional depending upon the requirements your animation must have.
 
Perusing the ULMAMover code below, you may notice that ULMAMover accepts two arguments called one round and the other infiniteLoop:
  • if only round is passed, it must be a number, and makes this function ready to perform, in the future, repetitive iterations over a path, and the layer will restart from the beginning of the path as soon as its end has been reached; it is for, arguably, circular paths. If you pass it anyway on linear paths, it would just go on repeating the path from the beginning.
    Example (foo your usual layerManager name placeholder):
    foo.ULMAMover.run(5);
  • If you want an infinite Loop, that is a never stopping following of the path continuously restarting from the beginning of the path (entry [0]) as soon as its end gets attained, you have to pass the following formula:

  • If you need to stop an infiniteLoop previously triggered or you want a function that can stop a moving layer and leave it still where it is, you have to define (that is: include it) among your scripts the following function:

    Then you call it to stop your layer passing as its first argument the layer ID (in between quotes) or the layerManager object itself (that is: without quotes the name of the variable which is the layerManager for the layer you want to stop from performing the infiniteLoop).
    Note this function is a static function, namely must be called on its own, it's not a layermanager method and therefore needs no such syntaxes like
    foo.ULMAMoverStopper.run(layerManager) //WRONG!
    ULMAMoverStopper(layerManager) //CORRECT!

     
    Such function in the textarea above when passed with just one argument (the mandatory layerManager) would immediately stop the layer from moving onto the path track and leave it still where it is. It won't reset the layer position to the starting point of its path, unless you pass a the third argument called resetPathIndex as number 1:
    ULMAMoverStopper(layerManager, 0, 1); //third argument set to 1: it repositions the layer to the beginning of the path

    If you pass a second argument named finishIt as number 1 instead of zero, the function would stop the infinite loop, but would also make the layer perform the path track to its end before a definitive stop.
Now your ULMAMover code:
function ULMAMover(rounds, infiniteLoop, alternate){
if(!this.isRunning){
/* REQUIRES: ULMA approach
* Requires: dispatcher(), shower()
* Conceived to be preferably used with pathMaker() to generate its path
*/
//no path?
if(!this.path||!this.path.length){
this.stop();
return true;
};
//initialize:
this.isRunning=1;
this.variable.layerEngaged=1;
if(rounds){
this.rounds=(!isNaN(parseFloat(rounds)) && ( parseFloat(rounds)-1 )>0)?
parseFloat(rounds)-1:0;
}
else{
this.rounds=(this.rounds && (this.rounds-1)>0)?
this.rounds-1:0;
}
this.infiniteLoop=(infiniteLoop || this.infiniteLoop)?1:0;
this.alternate=(this.alternate || alternate)?1:0;
this.currentRound=0;
this.currentPathIndex= (this.currentPathIndex>this.path.length-1)?
this.path.length-1:
(this.currentPathIndex<0)?
0:this.currentPathIndex;
this.variable.shower.execute(1);
}
//bad array entry:
if(!this.path[this.currentPathIndex].length){
this.stop();
this.isRunning=0;
return true;
}
//run:
this.variable.layerEngaged=1;
var y=this.path[this.currentPathIndex][0];
var x=this.path[this.currentPathIndex][1];
this.variable.dispatcher.execute(""+y, ""+x, this.noOffsets);
++this.currentPathIndex;
//end:
if(this.currentPathIndex==this.path.length){
  if(this.alternate){
  this.path.reverse();   
  };
  if(!this.infiniteLoop &&this.rounds && this.currentRound<this.rounds){
  this.currentPathIndex=(this.alternate)?1:0;
  this.currentRound++;
  return false;
  };
  if(this.infiniteLoop){
  this.currentPathIndex=(this.alternate)?1:0;
  return false;
  }
this.stop();
this.currentPathIndex=0;
this.currentRound=0;
this.rounds=0;
this.infiniteLoop=0;
this.alternate=0;
this.isRunning=0;
return true;
}
return false;
/*keep this comment to reuse freely
http://www.unitedscripters.com
*/}