Locks the Gradient Ramp’s start and end points so they stay aligned with your text layer in comp space.
thisLayer.toComp(value)
Apply this to the Start of Ramp and End of Ramp properties of a Gradient Ramp (or 4 Color Gradient, etc.). Works on text layers or any other layer where you want the gradient to stick in place.
// Convert the current property’s value (layer space) into comp space
thisLayer.toComp(value)
The expression looks at the property value of the Gradient Ramp point (Start or End).
Normally, these ramp point values are stored in the layer’s local coordinate system. That means if you move or animate the layer, the gradient points don’t naturally follow.
thisLayer.toComp(value)
converts that local value into composition space coordinates.
By doing this, the gradient ramp points stick to the same relative place on the text, even when you move, scale, or rotate the layer.
The result: no more gradients “sliding off” when animating your text—your Start and End of Ramp stay locked to the text itself.
Just copy the full expression code from the top of this page. Then Alt-click (or Option-click on Mac) the stopwatch on the property you want to animate. Paste the code into the editor and that's it. If you’re not sure which property to use, check the "Where to Apply" section above.
First, make sure your project is using the JavaScript engine (go to File > Project Settings > Expressions). Also double-check for missing characters, and see if the code requires parenting a layer. If so, there will be a comment in the code explaining what needs to be connected.
Take a look at the "How It Works" section on this page. It explains each part of the expression in plain language so you can understand how everything works together.
Yes, absolutely. Most expressions include easy-to-edit variables near the top and comments that guide you on what to change. You can also link sliders or checkboxes using Expression Controls if you want more control in the timeline.
Yes, you can use it on any property with a stopwatch. That includes Position, Scale, Opacity, and also effect settings like Blur or Tint.
In most cases, yes. These expressions are designed to adapt to your comp’s resolution and frame rate. If anything specific needs adjusting, it’ll be noted in the code or in the "How It Works" section.
Explore more expressions in this category
A versatile typewriter text animation that reveals characters progressively with a customizable blinking cursor, creating a realistic typing effect for any text layer.
Keeps the anchor point automatically centered based on the current size of a text layer.