How to Use Trim Paths in After Effects
The Trim Paths modifier in Adobe After Effects is a powerful vector tool used to control the visible portion of a shape layer's stroke over time. By animating its core parameters—Start, End, and Offset—motion designers can easily create dynamic line animations such as write-on text, self-drawing outlines, loading bars, and explosive accent bursts. This guide explains what the modifier is, how its key controls function, and the exact steps to create clean line animations.
What Is the Trim Paths Modifier?
Trim Paths is a parametric operation applied exclusively to shape layers. Instead of masking or drawing frame-by-frame, Trim Paths calculates the mathematical length of a vector path and limits the rendering of its stroke to a specified percentage. It works on both open paths (lines created with the Pen tool) and closed shapes (rectangles, ellipses, and custom polygons).
Core Properties of Trim Paths
Once added to a shape layer, Trim Paths provides four primary controls:
- Start: Defines the point along the path where the visible stroke begins, measured from 0% to 100%. Increasing this value eats away at the stroke from its original start point.
- End: Defines where the visible stroke stops, measured from 0% to 100%. Decreasing this value retracts the stroke toward the origin.
- Offset: Rotates or shifts the start and end positions along the path without altering the total length of the visible stroke. This is especially useful for closed shapes or continuous loops.
- Trim Multiple Shapes: When a shape layer contains multiple paths, this dropdown dictates whether the paths animate Simultaneously (all strokes draw at the same time) or Individually (the stroke finishes drawing one path before moving to the next).
How to Create a Basic Line Draw-On Animation
Follow these steps to animate a single line drawing onto the screen:
- Create a Path: Select the Pen Tool (G). Ensure the Fill is set to None and the Stroke is set to a solid color with your desired pixel width. Click in the Composition panel to draw a line or curve.
- Add Trim Paths: Twirl open the newly created Shape Layer in the timeline. Click the Add: button located next to the layer contents and select Trim Paths from the flyout menu.
- Set Initial Keyframes: Move the playhead to the
beginning of your timeline. Twirl open the Trim Paths 1
group, set the End value to
0%, and click the stopwatch icon to create a keyframe. - Set Final Keyframes: Move the playhead forward
(e.g., 1 or 2 seconds). Change the End value to
100%. A second keyframe will be generated automatically. - Refine Motion: Select both keyframes and press F9 to apply Easy Ease. Open the Graph Editor to adjust the speed curve for a smooth acceleration and deceleration.
Common Line Animation Techniques
1. The Chasing Line (Leading and Trailing)
To make a line enter, travel, and exit along a path, animate both Start and End:
- At frame 0, set both Start and End
to
0%. - At frame 30, set End to
100%. - At frame 45, set Start to
100%. Because the Start property lags slightly behind the End property, the line expands onto the screen and then contracts away.
2. Looping Strokes on Closed Shapes
To create a rotating border or continuous circuit:
- Draw an ellipse or rectangle.
- Add Trim Paths and set Start to
0%and End to25%(creating a quarter-segment of the shape). - Add keyframes to the Offset property, moving from
0°to360°(or use the expressiontime * 100) to send the segment continuously tracing the perimeter.
3. Styled Endings with Stroke Caps
Vector strokes default to flat ends (Butt Cap), which can look harsh when animating. Twirl open the layer's Stroke properties and change Line Cap to Round Cap. This adds smooth, semi-circular ends to your animated strokes, yielding a more polished and modern appearance.