View all expressions
Randomness

Gradient Ramp Fixed to Layer Edges

Keeps the gradient ramp fixed to the layer’s top and bottom edges, ensuring it moves seamlessly with the layer during animations.


// add to Start of Ramp
rect = thisLayer.sourceRectAtTime();
xPos = rect.left + rect.width / 2; // Center X
yPos = rect.top;  // Top Y
[thisLayer.toComp([xPos, yPos])[0], thisLayer.toComp([xPos, yPos])[1]]; // add to End of Ramp
rect = thisLayer.sourceRectAtTime();
xPos = rect.left + rect.width / 2;  // Center X
yPos = rect.top + rect.height;  // Bottom Y
[thisLayer.toComp([xPos, yPos])[0], thisLayer.toComp([xPos, yPos])[1]];

Gradient Ramp Fixed to Layer Edges

Practical use case

Perfect for animating backgrounds, shapes, or titles where a consistent gradient needs to stay aligned with the layer as it moves.

Check out similar expressions

Data-driven video workflows for After Effects are easier with Plainly.

a mesh of elegant lines transparent image