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

Is there any way to control the color property of a gradient on a shape layer using expressions?

Contributor ,
Oct 07, 2019 Oct 07, 2019

I can't find anything in the docs that lists the properties of a gradient (and x.reflect doesn't work any more since Adobe binned Extendscript, it seems). I've got something like this -

thisComp.layer("circle_bg").content("e3").content("Gradient Fill 1").colors

I want to go into this colors object and be able to set the position of the start and end knot of the gradient. Is this possible?

 

Thanks!

3.2K
Translate
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
Explorer ,
Oct 07, 2019 Oct 07, 2019

You can use expressions on the Start Point and End Point of the Gradient Fill object, but at the moment it's not possible to apply expressions to the Colors object. Seems like this would be a useful function though, especially if you wanted several gradients to match a master fill.

 

One workaround for more control is to use the Gradient Ramp or 4-Color Gradient effects, which allow you to control the colors individually, but that can be clunky and overcomplicated.

Translate
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
Contributor ,
Oct 07, 2019 Oct 07, 2019
Thanks, that's what I thought. I found a different way of doing what I needed - the "highlight length" property lets you set what percentage along the gradient's length to start the gradient at. Had never even looked at it before but it turns out to be useful 🙂
Translate
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
Contributor ,
Oct 07, 2019 Oct 07, 2019
bah, actually highlight length doesn't do that. It just offsets the centre of the gradient but doesn't have the same effects as moving the first knot towards the second. Back to the drawing board!
Translate
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
LEGEND ,
Oct 07, 2019 Oct 07, 2019

What final effect are you trying to create? The API for Gradient Fill may be useless, but there are other ways to create a graduated color which could be more scriptable (adjustment layers with blurred masks/tints/glows, etc.)

Translate
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
Contributor ,
Oct 08, 2019 Oct 08, 2019

gradient.jpgexpand imageI'm basically trying to control the position of the left-hand knot. This shape on the left is formed of 4 different shape groups on one layer, with the radii controlled by sliders. I'd like the yellowy gradient to always start from the edge of the second ellipse, irrespective of the relative radii of each ellipse.

 

If there were some property like

 

[...].content("Gradient Fill 1").colors.knots[0] it would make this easy!

Translate
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
Explorer ,
Jan 08, 2023 Jan 08, 2023

Hi, I am also looking for something similar. I aslo wonder if there is a way to use the expression change the first gradient color?

Translate
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
LEGEND ,
Jan 08, 2023 Jan 08, 2023

You still can't do any of that and that is that, as they say.

 

Mylenium 

Translate
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
New Here ,
Apr 05, 2024 Apr 05, 2024
LATEST

Use a Gradient effects like Gradient Ramp or 4 color gradient. Is the only way to map the gradients color, would be great in the future have more control on this. 

 

Good look

Translate
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