Copy link to clipboard
Copied
I'm trying to animate a complex line's end going back and forward. I need it to have a logical, constant speed, but the "rove accross time" function is greyed out...
Does anybody know how to do this?
I think this expression for the End property will level out the speed:
val = value;
if (numKeys > 2){
if (time < key(1).time){
val = key(1).value;
}else if (time > key(numKeys).time){
val = key(numKeys).value;
}else{
dTot = 0;
for (i = 2; i <= numKeys; i++){
dTot += Math.abs(key(i).value - key(i-1).value);
}
tTot = key(numKeys).time - key(1).time;
tCur = key(1).time;
i = 2;
while(tCur <= time && i <= numKeys){
tPrev = tCur;
tCur += (Mat
...
Copy link to clipboard
Copied
Select only the inner keyframes, not the start and end.
Mylenium
Copy link to clipboard
Copied
Still not working... 😞
Copy link to clipboard
Copied
My mistake. Rove only works for 2D and 3D properties as otherwise there's no way to calculate a speed vector. Refer to this:
https://helpx.adobe.com/after-effects/using/speed.html
That said, there's most definitely some script to even out keyframes and adjust the values, so check AEScripts.com.
Mylenium
Copy link to clipboard
Copied
Rove Across Time makes the speed between keyframes equal. You get the same thing with Trim Paths if you only have two keyframes. That should be all there is to it.
Copy link to clipboard
Copied
But you cannot rove across time with trim paths, that's my problem
Copy link to clipboard
Copied
I think Rove Across Time is programmed to only work with position values... but there is a way if you're up for a little bit of work.
Not exactly elegant, but it gets the job done.
Copy link to clipboard
Copied
I don't think you understand Rove Over Time's basic function.
If you select multiple keyframes for Position and enable Rove Over Time, the timing of the keyframes will be adjusted so that the speed between the starting and ending keyframes will be constant.
The speed will be constant if you have only two keyframes in any other property, like Trim Paths/End. If you want a constant speed between changing values, there is no reason to have more than two keyframes. If you set any additional keyframes and change the timing, the speed will no longer be constant.
Let me explain that in another way. If you need Trim Paths to be at 0% at 10 frames, 30% at 10 frames, and 100% at 40 frames, then you need three keyframes, and the speed between keyframes will be different. To make the speed between keyframes to be constant, you will need to move the middle keyframe or just delete it. It is easier to delete the keyframe to get the constant speed than to move it forward or backward in the timeline.
If you have the position to be at 200, 0 on frame 0, then go to 200, 400 at frame 10, then go to 200, 900 at frame 25, then the speed between keyframes will be 20 pixels per frame for the first 10 frames and 33.333 pixels per frame for the next 15 frames. Enable Rove Over Time the position of the keyframes will change so that the movement will be 900 pixels in 25 frames or 36 pixels per frame. If the movement is only along one axis, then you don't need 3 keyframes, but if you are moving in a curved path, you need more than two keyframes, and Rove Over Time will make the speed of movement the same over the entire length of the path.
Rove Over Time is an easy way to maintain a constant speed between position values. The way to get a constant speed in any other property is only to use two keyframes.
Copy link to clipboard
Copied
I still don't undersand how I can trim a path from 200 to 0 then 200 then 400 then 200 then 900 adjusting the keyframes in the timeline so there is constant speed (I cannot use just two keyframe for this)
Copy link to clipboard
Copied
I think this expression for the End property will level out the speed:
val = value;
if (numKeys > 2){
if (time < key(1).time){
val = key(1).value;
}else if (time > key(numKeys).time){
val = key(numKeys).value;
}else{
dTot = 0;
for (i = 2; i <= numKeys; i++){
dTot += Math.abs(key(i).value - key(i-1).value);
}
tTot = key(numKeys).time - key(1).time;
tCur = key(1).time;
i = 2;
while(tCur <= time && i <= numKeys){
tPrev = tCur;
tCur += (Math.abs(key(i).value - key(i-1).value)/dTot)*tTot;
i++;
}
i--;
val = linear(time,tPrev,tCur,key(i-1).value,key(i).value);
}
}
val
Copy link to clipboard
Copied
Thank you! This is what I needed!
Copy link to clipboard
Copied
Trim Paths only goes from 0 to 100%. If you stop or pause, the speed is not constant. If the speed needs to be constant and it needs to hit 50% at 3 seconds, then the first keyframe must be at zero seconds and the last at 6 seconds. If you need to start at 0% at 1-second, be at 50% at 4-seconds, then be at 100% at 10-seconds, the speed is not constant.
Dan, What does your expression do that setting only 2 keyframes will not? If it's the distance covered by the path, two keyframes will keep the speed the same. If you want a constant horizontal speed in a curved line, then you will need to figure out the X and Y coordinates for the path for each frame.
I duplicated a path, added two trim paths, animated 1 of them with just two keyframes, animated the other with 4 keyframes, changed the timing, added Dan's expression to the one with 4 keyframes, then copied each path and pasted it to a circle layer to trace the paths. With Dan's expression turned on, the speed of both Trim Paths is identical, and the moving circles following the path match the endpoint. Turn off Dan's expression, and the animations are out of sync.
I've uploaded the Project File.
Copy link to clipboard
Copied
OK, so here's what I was thinking. Say you've set 5 End parameter keyframes, at various times, over a 5-second period with values of 0, 20, 80, 30, and 100. So you have 4 segments of motion (including one going backwards) at various speeds, depending on where you put the keyframes. What the expression does, is first add up all the "travel" of the various segments, so in this case it would be 20 + 60 + 50 +70 = 200 total for the 4 segments. The expression then takes the travel of each segment and calculates what percentage of the total it is. So for the first segment it would be 20/200, or 10%. It uses that to calculate how much of the total time (5 seconds) that segment should have as its duration, so 0.5 seconds for the first segment. So it works out that in this example, each segment will traval at 40% per second, which actually matches the average of 200/5. You can verify in the speed graph that each segment is moving at 40 (or -40) percent per second. I'm not sure it's what @lume360 was asking for, but it was a fun exercise.
Copy link to clipboard
Copied
Where's the facepalm emoji. You're absolutely right. I spotted a solution without thinking it through.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now