I’ve been creating a lot of videos in After Effects like the one below. One thing I had to learn was to how to create that Dashed Line Repeating Animation.

There wasn’t anyway I could find out how to do this without writing a bit of scripts.

  1. First Select the Pen Tool

Select Pen Tool

  1. Click the Fill and Select the Transparent Color. Select a stroke color. This makes sure that you’re going to draw a path or line.

Select Fill and Color Tool

  1. Draw a path of your choice

Draw a Path

  1. Select the Shape Layer that was created that references the path that you just drew. Expand to Contents > Shape 1 > Stroke 1 > Dashes then press the + Button. Choose some number for the Dash and Offset Value until you see a dashed line.

Add Dashes

Dashes Being Set

  1. Now expand Dashes and now hold down the Option or Alt Key and click the Clock on Offset. You’ll be granted an place to add an expression. This is a script that will run

This is the code:

content("Shape 1").content("Stroke 1").dash.offset + -(250 * time)

  1. Press play! And now you should have it animating inifinitely.


  • To have the animation move in the opposite direction remove the - before the (250 * time)

So you should have something like this:

content("Shape 1").content("Stroke 1").dash.offset + (250 * time)
  • To have the shape move faster or slower change the number 250 to something else.

  • To reference other Shapes or Strokes, change "Shape 1" and "Stroke 1" to refer to differing paths and shapes.