Copy link to clipboard
Copied
Okay, first time doing a post like this, so please go easy on me everyone. I have been banging my head against this roadblock for the last few days
I have multiple lines that need to have a trim effect that comes out from the edge of the screen. They are all of various lengths and angles. What I am after is a way that all the lines emerge at the same speed, so that the shorter ones finish first while the longer ones finish last. Trim path seems to be the way to go, but that only works on a percentage, and I haven't found another way to get this to work. I figure an expression might be the way to go, but nothing I have tried has worked
I think to do it, your expression has to calculate the length of the path. This is an iterative expression for the Trim Path's End property that will give you the approximate length, which you can then use to calculate the current End percent:
spd = 100; // trim speed (pixels per second)
path = content("Shape 1").content("Path 1").path
numPts = 100;
accum = 0;
p1 = path.pointOnPath(0);
for (i = 1; i <= numPts; i++){
p0 = p1;
p1 = path.pointOnPath(i/numPts);
accum += length(p0,p1);
}
(spd*(
...
Copy link to clipboard
Copied
I'd be really tempted to not use Trim paths for this and use the linear wipe instead. Or use a mask or track matte for the layer to do the same thing.
But you may have more things going on on your shapes.
You could have a trim paths in each shape group, so that you have multiple keyframes to deal with.
Copy link to clipboard
Copied
If the lines were all going in the same direction, that would have been an option for me, but I have lines on all sides of different angles and lengths between points, and go towards the center.
Copy link to clipboard
Copied
I think to do it, your expression has to calculate the length of the path. This is an iterative expression for the Trim Path's End property that will give you the approximate length, which you can then use to calculate the current End percent:
spd = 100; // trim speed (pixels per second)
path = content("Shape 1").content("Path 1").path
numPts = 100;
accum = 0;
p1 = path.pointOnPath(0);
for (i = 1; i <= numPts; i++){
p0 = p1;
p1 = path.pointOnPath(i/numPts);
accum += length(p0,p1);
}
(spd*(time-inPoint)/accum)*100
Copy link to clipboard
Copied
Thanks I will give it a try and report back
Copy link to clipboard
Copied
This was what I was after. Thank you so much
Find more inspiration, events, and resources on the new Adobe Community
Explore Now