[Expressions] - How to make a gradient change of color using the position?
I have this expression:
// positions
let pX = transform.xPosition;
let minX = 0;
let maxX = 1920;
// colors
let color1 = hexToRgb("E300FF");
let color2 = hexToRgb("00FFA5");
linear(value, minX, maxX, color1, color2);
I know the 0 and the 1920 doesn't make sense, what I'm trying to do is reference the position of X at 0 and at 1920, so the color value changes while the shape is moving in between the points.
I thought of doing a control point at 0 and 1920 and use that as the reference, but it didn't work.
So I would like to know if it's possible to reference a shape layer inside another's shape layer expression.
Any other solution to this is really welcome!
Thanks 😄
