I find your use of the two "if statements" to set the ranges of values for X very interesting, but I am bewildered by how you can animate 5 separate components when you do not call the "attribute" in the animate statement nor do you use 5 animate calls.
Because I am trying to animate two or more objects in sequence I think your approach would work if only I get my head wrapped around how you are using the animate statement. For me this is my understanding of the animate statement:
animate("attribute",statement 1, statement 2, .... statment N) If I wanted to move component along the X axis I would use "animate("X",0,10) to move in 10 units in the positive direction.
Your statement within the base component animatecustom(Anim,5,,,0,5000) is confusing me as I don't see how using "Anim" tells the animatecustom command it is the X direction you wish to move the component. I do see how you are assigning values to the X attribute within the child components, but I don't see how it is transferred to the animate command within the base component. Could you explain to me how the use of "Anim" is seen as the "X" attribute value within your animatecustom(Anim,5,,,0,5000)statement? Also it is not clear why you don't have to use 5 distinct animate statements within the base component to active the 5 separate child components.
Thanks in advance for any information you can provide me to better understand your approach.