The gradientColor.angle
property contains a read-only gradient angle. There is no method in API to rotate gradient, we have to use rotate()
method to rotate objects. The angle
argument is required, the optional ones are: changePositions
, changeFillPatterns
, changeFillGradients
, changeStrokePattern
, rotateAbout
.
Let’s rotate the gradient by 60 degrees without rotating the object itself by setting true to the changeFillGradients
argument.
selection[0].rotate(60, false, false, true, false, Transformation.CENTER);
The problem with this method is that the resulting gradient angle is not readable by the script, nor by the Eyedropper tool with Eyedropper Options → Appearance enabled. After manually entering another angle in the Gradient panel, the bug remains. In CC 2021–2022, the eyedropper in this case copies the difference between the entered angle and the one in the script command.
Only manually changing the gradient resets this bug and the gradient is copied by dropper. But then scripted rotation is useless for us.