#target Illustrator
var width = 600;
var height = 300;
var doc = app.documents.add(null, width, height);
var p = doc.pathItems;
function randomNumber(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
for (var i = 0; i < 600; i++) {
var startColor = new GrayColor();
var endColor = new GrayColor();
startColor.gray = 100.0;
endColor.gray = 100.0;
var newGradient = app.activeDocument.gradients.add();
newGradient.name = "Gradient" + i;
newGradient.type = GradientType.LINEAR;
newGradient.gradientStops[0].rampPoint = randomNumber(10, 20);
newGradient.gradientStops[0].midPoint = randomNumber(61, 80);
newGradient.gradientStops[0].color = startColor;
newGradient.gradientStops[1].rampPoint = randomNumber(71, 90);
newGradient.gradientStops[1].color = endColor;
newGradient.gradientStops[1].opacity = 0;
var colorOfGradient = new GradientColor();
colorOfGradient.gradient = newGradient;
colorOfGradient.angle = 90;
var shape = p.add();
shape.setEntirePath([
[i, 0],
[i, 300],
]);
shape.strokeWidth = 2;
shape.closed = false;
shape.filled = false;
shape.strokeColor = colorOfGradient;
shape.rotate(90, false, false, true, false, Transformation.CENTER);
}
// for (i = 0; i < activeDocument.pageItems.length; i++) {
// obj = activeDocument.pageItems[i];
// obj.blendingMode = BlendModes.MULTIPLY;
// }
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.