Skip to main content
Inspiring
October 7, 2019
Question

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

  • October 7, 2019
  • 5 replies
  • 4158 views

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!

    This topic has been closed for replies.

    5 replies

    Participant
    April 5, 2024

    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

    Mylenium
    Legend
    January 8, 2023

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

     

    Mylenium 

    Inspiring
    October 8, 2019

    I'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!

    LW0121
    Inspiring
    January 8, 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?

    Legend
    October 8, 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.)

    Zondervan123
    Inspiring
    October 7, 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.

    Inspiring
    October 7, 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 🙂
    Inspiring
    October 7, 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!