Skip to main content
after effects

Ae Expression Lets You Easily Deform Layers on a Path

By October 31, 2017No Comments

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:

[syntax type=”css”]

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);

[/syntax]
lesterbanks

3D, VFX, design, and typography. Twenty year veteran instructor in all things computer graphics.