FORUMS: list search recent posts

Speedometer for moving objects.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Reuben Isaac
Speedometer for moving objects.
on Feb 11, 2014 at 6:11:03 pm

I am working on a large animation that has birds flying across the screen. The birds are at varying distances from the camera causing their perceived speed to be different based on how far away they are; the farther away, the slower they appear to move.

In order to keep the speed of the birds accurate and consistent I created a null object (called "Speedometer") with a slider control for each bird. I then created null objects for each bird (called "Speed Tracker [#]") I then copied the the position attribute from the bird to the Speed Tracker but offset it it by one frame so that the speed tracker is always 1 frame behind the bird. I then used the following expression to determine the speed.


point1=thisComp.layer("Speed Tracker 1").transform.position;
point2=thisComp.layer("Body Rig 1").transform.position;

delta=sub(point1, point2);

length(delta);


By doing this, I find the distance from where the bird is to where the bird was over the course of 1 frame thus I get a speed of "X Px/Frame"

Now, while this does work effectively, it isn't exactly efficient and is a bit clumsy. Is there a better way to accomplish this?


Return to posts index

Dan Ebberts
Re: Speedometer for moving objects.
on Feb 11, 2014 at 6:36:24 pm
Last Edited By Dan Ebberts on Feb 11, 2014 at 6:36:45 pm

How about:

thisComp.layer("Body Rig 1").transform.position.speed;


Dan



Return to posts index

Reuben Isaac
Re: Speedometer for moving objects.
on Feb 12, 2014 at 4:34:08 pm

Thanks Dan, however, when I try that I get a message saying that 'speed' does not exist.

"After Effects warning: property or method named 'speed' in Class 'Group' is missing or does not exist. It may have been renamed, moved, deleted, or the name may have been mistyped. A property expression refrencing it was disabled."


Return to posts index


Dan Ebberts
Re: Speedometer for moving objects.
on Feb 12, 2014 at 6:10:02 pm

The expression I posted initially had an error, so I did an edit, but you may have picked up the first version. I just tried this, and it should work:

thisComp.layer("Body Rig 1").transform.position.speed


Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]