Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- Adobe Support Community
- :
- After Effects
- :
- Calculate the traveled distance

Hi !

I'm making a 3D sequence in which a spherical object in moving on a plane by following a curve (its way isn't straight). I want the object to rotate as it moved, and adapt its rotation speed to the distance it's travelling (or its speed).

So the rotation angle A, is given by A = (360*X)/(d*Pi) where X is the traveled distance (between 2 frames) and d the diameter of the sphere. So I need to find how to compute the X value.

Can you help me please !

Thanks

Adobe Community Professional

The diameter is all you need. Combine that with simple vector math and a little valueAtTime.

Courtesy of Dan Ebberts:

f = this_comp.frame_duration;

dist = 0;

j = 0;

w = content("Ellipse 1").content("Ellipse Path 1").size[1]; // the diameter

while (j < time){

dist += length(position,position.value_at_time(time - f));

j += f;

}

360*dist/(w*Math.PI)

This is just one of my collection of more than 200 custom animation presets. I use them all the time to speed up my work.

This one works with any ellipse shape layer where the ellipse is a perfect circle and the transform ellipse position is zeroed out so the shape layer anchor point is at the center of the circle. To use it for a sphere rolling along a path you can either use the pick whip to grab the diameter of the sphere (multiply by 2 if you only have a radius value) or simply just type in the diameter for the "w" value.

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn More

Hi !

I'm making a 3D sequence in which a spherical object in moving on a plane by following a curve (its way isn't straight). I want the object to rotate as it moved, and adapt its rotation speed to the distance it's travelling (or its speed).

So the rotation angle A, is given by A = (360*X)/(d*Pi) where X is the traveled distance (between 2 frames) and d the diameter of the sphere. So I need to find how to compute the X value.

Can you help me please !

Thanks

Adobe Community Professional

The diameter is all you need. Combine that with simple vector math and a little valueAtTime.

Courtesy of Dan Ebberts:

f = this_comp.frame_duration;

dist = 0;

j = 0;

w = content("Ellipse 1").content("Ellipse Path 1").size[1]; // the diameter

while (j < time){

dist += length(position,position.value_at_time(time - f));

j += f;

}

360*dist/(w*Math.PI)

This is just one of my collection of more than 200 custom animation presets. I use them all the time to speed up my work.

This one works with any ellipse shape layer where the ellipse is a perfect circle and the transform ellipse position is zeroed out so the shape layer anchor point is at the center of the circle. To use it for a sphere rolling along a path you can either use the pick whip to grab the diameter of the sphere (multiply by 2 if you only have a radius value) or simply just type in the diameter for the "w" value.

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn More

3
Replies

Re: Calculate the traveled distance

How are you determining the diameter of the sphere? What's your measurement?

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn More

Reply

Loading...

Re: Calculate the traveled distance

Adobe Community Professional
,
Jul 09, 2018

I stink at math but at the risk of embarrassing myself, here's what I think.

Like Dave alluded to the unit of measure needs to be the same for the circumference of the circle and the length of the curve.

So...pull up your rulers & determine the diameter of circle then do the math.

For the curve, I believe you need to add together the pixels in x and the pixels in y. So again using the comp window rulers. Determine the length of the curve in x and the height of it in y. Add those two numbers together and you have the distance in pixels (I think).

Did I make sense? Honestly I'll be surprised if I'm right.

Community Guidelines

Reply

Loading...

Adobe Community Professional
,
Jul 09, 2018

The diameter is all you need. Combine that with simple vector math and a little valueAtTime.

Courtesy of Dan Ebberts:

f = this_comp.frame_duration;

dist = 0;

j = 0;

w = content("Ellipse 1").content("Ellipse Path 1").size[1]; // the diameter

while (j < time){

dist += length(position,position.value_at_time(time - f));

j += f;

}

360*dist/(w*Math.PI)

This is just one of my collection of more than 200 custom animation presets. I use them all the time to speed up my work.

This one works with any ellipse shape layer where the ellipse is a perfect circle and the transform ellipse position is zeroed out so the shape layer anchor point is at the center of the circle. To use it for a sphere rolling along a path you can either use the pick whip to grab the diameter of the sphere (multiply by 2 if you only have a radius value) or simply just type in the diameter for the "w" value.

Community Guidelines

Reply

Loading...

Resources

Troubleshooting

Knowledge Base Articles

User Guide

Add a group

Community Help
Experience League
Terms of Use
Privacy Policy
Cookies
AdChoices
Language:

- Deutsch
- English
- Español
- Français
- 日本語
- Português

Copyright © 2020 Adobe. All rights reserved.