ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Animating a train: trailing, expressions and positioning problem

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Kate Boelens
Animating a train: trailing, expressions and positioning problem
on Apr 24, 2014 at 8:15:49 pm

Dear CC users,

I have stumbled upon a problem my brain cannot seem to solve.

I am trying to animate a train where the cars follow the leading locomotive (they should follow the path with a certain delay). I have found the expression that should let me do this - thisComp.layer("name").transform.position.valueAtTime(time - sometime) - and while this works in a very basic setup, it for some reason won't work in my composition! The problem is when I add this expression to the layer that should follow the lead, it JUMPS AWAY, as in, it re-positions itself and starts hanging somewhere in the middle of the screen! And for some reason I am not able to position it in the way I want to (it just won't move).

I have created a null object which follows a certain path. I have linked the train to this null object using parenting and positioned it alongside the path (this works like it should). And then, I position my following car behind the train (I am not linking it to anything), I add this expression, and BOOM, away it goes, ending up NOT at all behind the train, but hanging in the air. It does follow the path, in the air, with the needed delay, but there's just no way that I can position it where in should be!

What could explain this behavior??? I'm a bit at loss here and I hope that you could help me out...

Thank you very very much for your time!


Return to posts index

George Goodman
Re: Animating a train: trailing, expressions and positioning problem
on Apr 25, 2014 at 1:28:23 pm

Since you're leading car is referencing a null object the position and anchor point are relative (not sure if that's the best explanation, but basically, ya that's what happens). Why don't you just place the second car where you want it in relation to the leading car and parent it to either the null or the leading car?


"|_ (°_0) _|"

Sincerely,

George


Return to posts index

Kate Boelens
Re: Animating a train: trailing, expressions and positioning problem
on Apr 25, 2014 at 5:34:57 pm

Thank you very much for your answer, George!

The problem is that the path the train should follow is a hill. The locomotive orients itself along the path (as in, it turns up when going up and turns down when down when going downwards). The cars should show the same behavior, but with a delay. When I link the cars to either the train, or the null object, they show this behavior simultaneously, so it looks like it's one long stiff object, instead of multiple objects joined together by a flexible connection.


Return to posts index


George Goodman
Re: Animating a train: trailing, expressions and positioning problem
on Apr 25, 2014 at 6:14:53 pm

Gotchya.

Can you just remove the null object from the equation and apply the animation directly to the leading train? If you can do that, then your expression should work provided you have the time delay correct.


"|_ (°_0) _|"

Sincerely,

George


Return to posts index

Walter Soyka
Re: Animating a train: trailing, expressions and positioning problem
on Apr 25, 2014 at 7:51:38 pm

As George says, the jumping occurs because the two layers have different parents. The first layer is parented to a null, and the second layer has no parent. This means that the layer space for the first layer is relative to its parent, but the layer space for the second layer is relative to the comp.

You should be able to fix this with toWorld():

toWorld( thisComp.layer("name").transform.position.valueAtTime(time - sometime))

Walter Soyka
Principal & Designer at Keen Live
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
RenderBreak Blog - What I'm thinking when my workstation's thinking
Creative Cow Forum Host: Live & Stage Events


Return to posts index

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