AE Null Object and Shape Layer Edge Binding Control
A summary of the universal approach for linking sliders with expressions in AE to achieve stable binding between null objects and shape layer edges.
A summary of the universal approach for linking sliders with expressions in AE to achieve stable binding between null objects and shape layer edges.
In After Effects, if you need a null object to stay glued to a shape layer edge without hand-keyframing every adjustment, sliders paired with expressions are the most reliable approach: the slider reads edge value changes, and the expression converts the delta into a position offset so the relative distance stays fixed. Below is the core idea, a reusable template, and practical notes for getting it right.
After enough trial and error, the whole chain boils down to three steps—slider captures change, expression converts position, relative relationship stays fixed:
Following that logic, you get a reusable pattern. For different edges, only the baseline parameters change:
// Universal expression for null object and shape layer edge binding
s = thisComp.layer('转换值').effect('滑块控制')('滑块')
baseSlider = baseEdgeValue
baseValue = nullObjectInitialPosition
// Adjust null object position synchronously based on edge changes, maintaining relative position
baseValue + (s - baseSlider) / 2
Here, s is the live slider value, baseSlider is the edge’s initial baseline,
and baseValue is the null’s starting position. Compute the offset with
(s - baseSlider) / 2, add it to baseValue, and the null tracks smoothly.
Both scenarios below use the same expression structure—swap in different baseline values.
The null sticks to a target edge on the shape layer and moves with it.
s = thisComp.layer('转换值').effect('滑块控制')('滑块')
baseSlider = baseEdgeValue
baseValue = nullObjectInitialPosition
baseValue + (s - baseSlider) / 2
When the slider moves, the null adjusts in step—the relative distance to the target edge never changes.
Several nulls each bound to a different edge, each keeping its own stable relative position.
s = thisComp.layer('转换值').effect('滑块控制')('滑块')
baseSlider = baseEdgeValue
baseValue = nullObjectInitialPosition
baseValue + (s - baseSlider) / 2
The same logic scales to more nulls and more edges.
"转换值" and "滑块控制" must exactly
match AE (spaces and capitalization count), or the expression will error.baseSlider and baseValue must
reflect the initial frame, or the binding drifts.Alt, click the stopwatch on the null’s
Position (or individual X / Y), then paste./2 to another coefficient to tune how
strongly the null follows the edge.The whole approach rests on two things: a slider that captures edge change, and an expression that converts it to position. Once the template is familiar, multi-null, multi-edge setups come together quickly—with less repetitive tweaking and more stable motion.