Trouble understanding how gradientStops.add() works
Hello,
I'm just playing with gradientStops.add(), and I was having trouble getting my stops to be evenly spaced along the gradient from 0 to 100.
Here's a semi-functional code snippet:
grad = app.activeDocument.gradients.add();
for (i = 0; i < swatches.length; i++) {
stop = grad.gradientStops.add();
stop.color = swatches.color;
grad.rampPoint = ((100 / l) * (i + 1));
grad.midPoint = 50;
}
Where my "swatches" var contains a list of color objects.
When I run the above code, I get this:

Why do my gradient stops start at 50% and go towards the right (exponentially?)? I feel like my math is right, but it doesn't seem to be working like how I would expect it to.
My goal is to evenly spread the gradient stops across the full width of the gradient itself, from 0 to 100.
Could anyone help kick me in the right direction?
Thanks so much in advance!
Cheers,
Micky
MgradientStopsgra
