View all expressions
Randomness

Gradient Ramp Fixed to Layer Edges, Ignore Rotation

Keeps the gradient ramp aligned to the layer’s top and bottom edges, ignoring layer rotation to maintain a consistent gradient angle during animations.


// add to Start of Ramp
rect = thisLayer.sourceRectAtTime(time, false);
scaleFactor = thisLayer.scale[1] / 100;  // Y scale factor
xPos = thisLayer.position[0];
yPos = thisLayer.position[1] - (rect.height / 2) * scaleFactor;
[xPos, yPos]; // add to End of Ramp
rect = thisLayer.sourceRectAtTime(time, false);
scaleFactor = thisLayer.scale[1] / 100; // Y scale factor
xPos = thisLayer.position[0];
yPos = thisLayer.position[1] + (rect.height / 2) * scaleFactor;[xPos, yPos];

Gradient Ramp Fixed to Layer Edges, Ignore Rotation

Practical use case

Ideal for animated backgrounds, shapes, or titles where the gradient should stay fixed to the layer’s edges without rotating, preserving a stable gradient effect regardless of layer rotation.

Check out similar expressions

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

a mesh of elegant lines transparent image