Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
1

How to change the gradient length?

Engaged ,
Oct 11, 2023 Oct 11, 2023

Copy link to clipboard

Copied

Hi all


A radial gradient of two colors, black and white, is applied to the object as a fill color.
By default, the length of the gradient is from the starting point in the middle of the bounding box to the ending point at the edge of the bounding box. How can I change this length using script commands?

 

Gradient.pngexpand image

 

when you change this length manually, and then using the command
var L = item.fillColor.length
you get this value (72.236), then the expected result is displayed.


But the commander is like item.fillColor.length = 152 does not change this length???

TOPICS
Scripting

Views

281
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Oct 11, 2023 Oct 11, 2023

It's a bug. A gradient's origin, length and angle cannot be overwritten.

 

Here's an elaborate workaround courtesy of CarlosCanto. This doubles a gradient's length (of a selected item) in the right direction:

var fillcolor = app.selection[0].fillColor;
app.selection[0].filled = false;
app.selection[0].fillColor = fillcolor;
app.selection[0].fillOverprint = app.selection[0].fillOverprint;
var f = app.getScaleMatrix(200, 100);  // double x
app.selection[0].transform(
    f, false, false, true, false,
...

Votes

Translate
Adobe
Guide ,
Oct 11, 2023 Oct 11, 2023

Copy link to clipboard

Copied

LATEST

It's a bug. A gradient's origin, length and angle cannot be overwritten.

 

Here's an elaborate workaround courtesy of CarlosCanto. This doubles a gradient's length (of a selected item) in the right direction:

var fillcolor = app.selection[0].fillColor;
app.selection[0].filled = false;
app.selection[0].fillColor = fillcolor;
app.selection[0].fillOverprint = app.selection[0].fillOverprint;
var f = app.getScaleMatrix(200, 100);  // double x
app.selection[0].transform(
    f, false, false, true, false, 0, Transformation.LEFT);

 

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines