Copy link to clipboard
Copied
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)?
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)
Copy link to clipboard
Copied
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)