Unable to change angle of gradient
gradientColor has an angle property, which I presume corresponds to or is similar to the Angle in the Gradient panel. Default is 0 and the gradient is horizontal. To make the gradient vertical, I tried assigning -90 (and 90), but nothing happens. If I print gradientColor properties, it shows angle is -90, but if I print fillColor properties, it shows angle is 0. What could be the problem? (I don't know if the origin property is relevant, but that doesn't seem to stick either. Interestingly, if I set Angle to -90 in the Gradient panel and then run the script, the gradient is vertical; but if I close the Gradient panel, open a new document and then run the script, the gradient is horizontal.)
Thanks in advance.

var w = 250, h = 250;
var d = app.activeDocument.artboards[0].artboardRect;
var paths = app.activeDocument.pathItems;
var rect1 = paths.rectangle(d[3]/2+h/2, d[2]/2-w/2, w, h);
rect1.stroked = false;
var startColor = new CMYKColor();
var endColor = new CMYKColor();
endColor.cyan = 100;
var gradient1 = activeDocument.gradients.add();
gradient1.type = GradientType.LINEAR;
gradient1.gradientStops[0].color = startColor;
gradient1.gradientStops[1].color = endColor;
var gradientColor1 = new GradientColor();
gradientColor1.gradient = gradient1;
gradientColor1.origin = [ d[2]/2, d[3]/2+h/2 ];
gradientColor1.length = h;
gradientColor1.angle = -90;
rect1.fillColor = gradientColor1;gradientColor1 properties:
origin - 297.64013671875,-295.94482421875
angle - -90
length - 250
hiliteAngle - 0
hiliteLength - 0
matrix - [Matrix]
gradient - [Gradient Untitled Gradient]
typename - GradientColor
rect1.fillColor properties:
origin - 172,-420
angle - 0
length - 250.00048828125
hiliteAngle - 0
hiliteLength - 0
matrix - [Matrix]
gradient - [Gradient Untitled Gradient]
typename - GradientColor
