The AddPoint method will create new lines within your xpLinesObject.
To animate it is a different story. You would not animate the Lines Object, you would instead animate the Scale X and Y of a Quad Mask that is using the new and previous points of the lines object to resize and reposition itself.
To prepare, create your Line Object and create a Quad Mask as a child of the Line Object.
Your script will have to do the following:
1. Determine the new X and Y coordinates of the next point in the Line List. (Do not use the AddPoint method yet, just hold those values in a variable)
2. Change the width of a Mask Quad to equal the (absolute value) difference in X between the new point and the previous point
3. Change the height of the Mask Quad to equal the (absolute value) difference in Y between the new point and the previous point
4. Move the pivot point of the mask quad to a specific corner that is determined by the new point in relation to the previous point. (refer to 4a-4e)
4a. First, reset the pivot point of the quad to X=0, Y=0. (this puts the pivot point in the middle of the quad)
4b. If the new point's X value is GREATER than the previous point's X value, ADD half the width of the quad from the Pivot X of the quad. For example, if the previous point is at X = 50 and the next point is at X = 100, the quad's width should be 50 (from step 2) and the Pivot X should be set to 25.
4c. If the new point's X value is LESS than the previous point's X value, SUBTRACT half the width of the quad from the Pivot X of the quad. For example, if the previous point is at X = 50 and the next point is at X = 0, the quad's width should be 50 (from step 2) and the Pivot X should be set to -25.
4d. If the new point's Y value is GREATER than the previous point's Y value, ADD half the height of the quad from the Pivot Y of the quad. For example, if the previous point is at Y = 50 and the next point is at Y = 100, the quad's height should be 50 (from step 3) and the Pivot Y should be set to 25.
4e. If the new point's Y value is LESS than the previous point's Y value, SUBTRACT half the height of the quad from the Pivot Y of the quad. For example, if the previous point is at Y = 50 and the next point is at Y = 0, the quad's height should be 50 (from step 3) and the Pivot Y should be set to -25.
5. Move the quad's X and Y position to match the coordinates of the new point.
6. Set the Scale X and Scale Y of the quad mask to 1.
7. Use the AddPoint method to add the new point, thus creating the line underneath the mask.
You can then use an animation controller that animates the quad's Scale X and Y from "1" to "0" to animate the reveal.
edit: If the new point doesn't have a change in X, set the width to (at least) the diameter of the line and keep Pivot X at 0. If the new point doesn't have a change in Y, set the height to (at least) the diameter of the line and keep Pivot Y at 0.
#XPression