Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Follow path horizontally centered

Explorer ,
Jun 12, 2023 Jun 12, 2023

Hello,

Is there a way to horizontally center the circle in the composition while following the path?

Right now the speed of the circle is not aligned with the scroll because the path is not linear (video attached)

Thanks in advance

-Josh

TOPICS
Scripting
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 12, 2023 Jun 12, 2023

Looks like you just need to apply the same easing values to your circle as you have on the scroll. And also same keyframe start/end time (which I think you already have)

 

Note: you could also play "seperate dimensions" on your circle position, but matching easing values seems easier.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 12, 2023 Jun 12, 2023

Hey thx for your answer.

The problem I have with the easing that the altitude of the path makes it way different than the linear scrolling animation because the circle has to move futher. I can't think of a way to match the easing like that. If you know a solution for that I'd love to hear it. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 12, 2023 Jun 12, 2023

How are you tracking the path?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 13, 2023 Jun 13, 2023

I copied the path from the line and pasted it in the position of the circle. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2023 Jun 13, 2023

Try this position expression developed by Filip Vandueren:

t1= key(1).time;
t2= key(numKeys).time;

x1=key(1).value[0];
x2=key(numKeys).value[0];

linear_x=linear(time, t1, t2, x1, x2);

precision = 3; // make this higher (16) if you need Motion blur
fd = thisComp.frameDuration/precision;

y=key(1).value[1];

for (t=t1; !(t>t2); t+=fd) {
	v=valueAtTime(t);
	if (v[0]>=linear_x) {
		y=v[1]; 
		break;
	}
}

[linear_x,y];
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2023 Jun 13, 2023

Wow, I didn't test it, but just from looking at the code it looks in deed like this retimes the motion to obtain a constant X speed.
It seems like 

if (v[0]>=linear_x) {

assumes that the x values increase over time. If your circle moves right to left, they decrease, so you probably have to replace the >= by <=

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 14, 2023 Jun 14, 2023
LATEST

Good point. I think this version would go right to left:

t1= key(1).time;
t2= key(numKeys).time;

x1=key(1).value[0];
x2=key(numKeys).value[0];

linear_x=linear(time, t1, t2, x2, x1);

precision = 3; // make this higher (16) if you need Motion blur
fd = thisComp.frameDuration/precision;

y=key(2).value[1];

for (t=t2; !(t<t1); t-=fd) {
	v=valueAtTime(t);
	if (v[0]<=linear_x) {
		y=v[1]; 
		break;
	}
}

[linear_x,y];
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2023 Jun 13, 2023

Oh, yes, that's a tricky problem. If you separate dimensions, it will most likely change the motion path (probably already in the moment you separate, but if not then definitely when you start changing the easing of x or y independently).

If the scrolling animation is linear, your goal should be to change the easing such that the value graph for X becomes a straight line, however, it will probably be very tricky to eyeball that. You would need to link the speed of the circle to the slope of the curve, somehow. The steeper it is, the faster it needs to move.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 13, 2023 Jun 13, 2023

thank you for your answer, do you know a way to link the speed to the slope of the curve?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2023 Jun 13, 2023

No, unfortunately not.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 13, 2023 Jun 13, 2023

Just an idea: does the circle and line align when you use linear keyframes? You could then precomp the animation and apply time remap with the desired easing.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 13, 2023 Jun 13, 2023

Hey Christian, sadly no, it still doesn't line up 😞

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines