Ae Expression Lets You Easily Deform Layers on a Path

Satoru Yonekura Shares a Little After Effects Expressions That Will Let You Deform and Animate Layers Along a Path

More new things emerge from After Effects’ new found ability to control points in a path. Ae user Satoru Yonekura has created a little script for After Effects that lets you animate and deform a layer against a path. The expression creates a setup that can be seen as similar to a “WayFinder” effect by Paul Conigliaro.

All you need is a path and an object. The script offers controls for offset and width. With the offset control you can easily animate the object against the path. The element will deform and conform to the path as well, bending for the corners.

Add this to your Bar or FT toolbar or keep it handy for later reference:

dist = effect(“Offset”)(“Slider”); // Position on path.

w = effect(“Width”)(“Slider”); // Normal direction width.

restpath = thisProperty;

targetpath = thisComp.layer(“Path”).content(“Shape 1”).content(“Path 1”).path; // Target Path

refpt = restpath.points();

refintan = restpath.inTangents();

refouttan = restpath.outTangents();

points =[];

intangents = [];

outtangents = [];

for(i=0; i<refpt.length; i++){

rest = refpt[i];

f = dist + rest[0] / thisComp.width;

pathpoint = targetpath.pointOnPath(f);

pathnormal = targetpath.normalOnPath(f);

angle = Math.atan2(-pathnormal[0], pathnormal[1]);

intanx = refintan[i][0] * Math.cos(angle) – refintan[i][1] * Math.sin(angle);

intany = refintan[i][0] * Math.sin(angle) + refintan[i][1] * Math.cos(angle);

outtanx = refouttan[i][0] * Math.cos(angle) – refouttan[i][1] * Math.sin(angle);

outtany = refouttan[i][0] * Math.sin(angle) + refouttan[i][1] * Math.cos(angle);

points.push( pathpoint + pathnormal * rest[1] *w);

intangents.push( [intanx, intany * w] );

outtangents.push( [ outtanx, outtany * w] );


createPath(points, intangents, outtangents);

Some of the links on lesterbanks are "affiliate links", a link with a special tracking code. This means if you click on an affiliate link and purchase the item, we will receive an affiliate commission. The price of the item is the same whether it is an affiliate link or not. Regardless, we only recommend products or services we believe will add value to our readers. By using the affiliate links, you are helping support our Website, and we genuinely appreciate your support.