Copy link to clipboard
Copied
Hi friends
Suppose I have an object filled with a linear gradient. This object is the only selected. I just would like to change the angle of the gradient to 25 degrees. So I think I could do:
var doc = app.activeDocument
alert(doc.selection[0].fillColor.angle) // the result is the exact angle of the gradient fill of the selected object. Suppose 12 degrees.
//now the try to change:
doc.selection[0].fillColor.angle = 25.0
---
No errors are found by the Extended Script Toolkit..BUT...it does not change anything. As Illustrator reference manual does not say this property is read only, I think I could write.
Am I missing anything?
Thank you a lot for the help
Best Regards
Gustavo.
It's tricky.
// GradientBlackWhite_rotated.jsx
// requires an open document and one selected object
var newGradient = app.activeDocument.gradients.add();
var colorOfGradient = new GradientColor();
var myGradientAngle = 80;
colorOfGradient.gradient = newGradient;
doc.selection[0].fillColor = colorOfGradient;
/*Thanx to John Wundes for this -->*/doc.selection[0].rotate(myGradientAngle, false, false, true, false, Transformation.CENTER);
redraw();
alert("gedreht");
Have fun
Copy link to clipboard
Copied
It's tricky.
// GradientBlackWhite_rotated.jsx
// requires an open document and one selected object
var newGradient = app.activeDocument.gradients.add();
var colorOfGradient = new GradientColor();
var myGradientAngle = 80;
colorOfGradient.gradient = newGradient;
doc.selection[0].fillColor = colorOfGradient;
/*Thanx to John Wundes for this -->*/doc.selection[0].rotate(myGradientAngle, false, false, true, false, Transformation.CENTER);
redraw();
alert("gedreht");
Have fun
Copy link to clipboard
Copied
Thank you for the tip.
Will adapt this code to my needs
Thank you a lot
Best Regards
Gustavo.