View all expressions
Motion

Procedural Zig-Zag Line Expression

Evenly spaces a set number of points along a line and alternates their Y-positions up/down to form a zig-zag.

Contributed by:


verts = Math.max(2, Math.floor(effect("Vertices")("Slider"))); // number of points
l = effect("Length")("Slider"); // total line length in px
amplitude = effect("Amplitude")("Slider"); // zig-zag height in px
seg  = l / (verts - 1);
half = l / 2;
pts = [];
inT = [];
outT = [];
for (i = 0; i < verts; i++) {
 x = -half + seg * i;
 y = (i % 2 === 0) ? amplitude : -amplitude;
 pts.push([x, y]);
 inT.push([0, 0]);
 outT.push([0, 0]);
}
createPath(pts, inT, outT, false);

Procedural Zig-Zag Line Expression

Practical use case

Create customizable zig-zag dividers or energy lines in seconds.

Check out similar expressions

Data-driven video workflows for After Effects are easier with Plainly.

a mesh of elegant lines transparent image