Skip to main content
Participant
Jun 25, 2024 7:06 PM UTC
Answered

Trim path follow expression

Greetings,

I have an expression for a shape to follow the trim path of another shape.

 

var path = thisComp.layer("Shape Layer 3").content("Path 1").path;

var trimPath = thisComp.layer("Shape Layer 3").content("Trim Paths 1").end / 100;

var targetLayer = thisComp.layer("Shape Layer 3");

var point = path.pointOnPath(trimPath);

targetLayer.toComp(point)

 

Would it be possible to account for trim path offset (on the trim paths 1)? 

 

This topic is closed to new replies. Start a new post to keep the conversation going.
Dan Ebberts
Dan EbbertsCorrect answer
Community Expert
Jun 25, 2024 9:09 PM UTC

It's probably going to be something like this, although I'm not sure what should happen when the offset wraps around:

 

 

var targetLayer = thisComp.layer("Shape Layer 3");
var path = targetLayer.content("Path 1").path;
var trimPath = targetLayer.content("Trim Paths 1").end / 100;
var offset = (targetLayer.content("Trim Paths 1").offset%360)/360;
var point = path.pointOnPath((trimPath + offset)%1);

targetLayer.toComp(point)

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
Jun 25, 2024 9:09 PM UTC

It's probably going to be something like this, although I'm not sure what should happen when the offset wraps around:

 

 

var targetLayer = thisComp.layer("Shape Layer 3");
var path = targetLayer.content("Path 1").path;
var trimPath = targetLayer.content("Trim Paths 1").end / 100;
var offset = (targetLayer.content("Trim Paths 1").offset%360)/360;
var point = path.pointOnPath((trimPath + offset)%1);

targetLayer.toComp(point)
Translate