How to Access Slider Controls in After Effects Expressions

Slider Controls are essential tools in Adobe After Effects that allow you to drive animation properties dynamically through expressions. By acting as variable controllers, they enable you to link multiple layers, adjust complex values globally, and build flexible motion graphics templates. This guide explains the precise expression syntax needed to reference Slider Controls on the same layer, across different layers, and across different compositions, along with practical implementation examples.

Adding a Slider Control

To use a Slider Control, you must first apply it to a layer:

  1. Select the layer (commonly a Null Object used as a master controller).
  2. Go to the top menu and select Effect > Expression Controls > Slider Control.
  3. In the Effect Controls panel, rename the slider to something descriptive (e.g., "Master Opacity") by selecting it and pressing Enter.

Basic Syntax for Referencing Sliders

The expression syntax changes depending on where the Slider Control is located relative to the property you are animating.

1. Slider on the Same Layer

If the Slider Control and the target property exist on the exact same layer, access the slider value with:

effect("Slider Control")("Slider")

If you renamed the effect:

effect("Master Opacity")("Slider")

2. Slider on a Different Layer

To reference a slider residing on another layer within the same composition (such as a Null layer named "Controller"):

thisComp.layer("Controller").effect("Slider Control")("Slider")

3. Slider in a Different Composition

To control a property using a slider located inside a separate composition:

comp("Master Comp").layer("Controller").effect("Slider Control")("Slider")

Using the Expression Pick Whip

The fastest and most error-free method to generate this code is using the pick whip:

  1. Alt-click (Windows) or Option-click (macOS) the stopwatch of the property you want to automate.
  2. Ensure the layer containing your Slider Control is visible in the Timeline or open in the Effect Controls panel.
  3. Drag the spiral pick whip icon from your active expression line directly onto the word Slider (or the numerical value) of the Slider Control.
  4. Release the mouse. After Effects will automatically generate the correct syntax.

Practical Implementation Examples

Driving Multi-Dimensional Properties

Sliders output a single floating-point number. If you apply a slider to a 2D property like Position or Scale, you must assign the slider value to an array.

Linking uniform Scale to a slider:

s = thisComp.layer("Controller").effect("Scale Slider")("Slider");
[s, s]

Controlling only the Y-position while keeping original X-position:

y = thisComp.layer("Controller").effect("Y Pos Slider")("Slider");
[value[0], y]

Combining Sliders with JavaScript Math

You can combine slider values with native JavaScript functions to modify output behavior:

val = thisComp.layer("Controller").effect("Slider Control")("Slider");
Math.round(val) // Rounds to the nearest whole integer

Best Practices

  • Rename Immediately: Always rename your Slider Control effect before linking properties to it. If you rename it after writing expressions, references that rely on string names may break.
  • Consolidate Controls: Keep your sliders on a dedicated, locked Null layer named CTRL or Global Controller at the top of your layer stack for easy navigation and maintenance.