ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Trying to animate only y possition with an expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nick_Espo
Trying to animate only y possition with an expression
on Jun 10, 2006 at 5:04:39 pm

Hi,
I'm trying to animate the y motion of a layer with an expression that references audio keyframes.
My problem is that I can't isolate only the y axis with the whip. Any ideas?


Cheers!
Nick Espo


Return to posts index

Mylenium
Re: Trying to animate only y possition with an expression
on Jun 10, 2006 at 5:42:27 pm

Assuming you used the "Audio to Keyframes" keyframe assistant, this will work:

[position[0],thisComp.layer("Audio Amplitude").effect("Left Channel")("Slider")]

Mylenium

[Pour Myl


Return to posts index

Dan Ebberts
Re: Trying to animate only y possition with an expression
on Jun 10, 2006 at 5:59:42 pm

If you just want to offset your y position with the audio amplitude, you probably want something like this:

multiplier = -5;
audio = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
value + [0,audio*multiplier]

Adjust multiplier to set the direction (minus is up) and amplitude of movement.

Dan


Return to posts index


Nick_Espo
Re: Trying to animate only y possition with an expression
on Jun 10, 2006 at 7:24:40 pm

Thanks for you answers, I did use convert audio to keyframes.

My problem is I can't animate only the y position.
When I add the expression it effects both the x & y

How would I make the expression target only the y axis of movement?



Cheers!
Nick Espo


Return to posts index

Dan Ebberts
Re: Trying to animate only y possition with an expression
on Jun 10, 2006 at 7:53:29 pm

Which expression are you talking about? Either of the ones suggested here should only affect y.

Dan


Return to posts index

Nick_Espo
Re: Trying to animate only y possition with an expression
on Jun 10, 2006 at 8:03:54 pm

Thanks guys for your time!

I used this one:
[position[0],thisComp.layer("Audio Amplitude").effect("Left Channel")("Slider")]

For my own edification. How would I change this expression and make it effect the y axis?




Cheers!
Nick Espo


Return to posts index


Dan Ebberts
Re: Trying to animate only y possition with an expression
on Jun 10, 2006 at 8:16:48 pm

That expression should move your layer to the top of the comp (without changing the x position) and bounce it downward in response to the audio (i.e. on the y axis only). Is that not what it does for you?

Dan


Return to posts index

Nick_Espo
Re: Trying to animate only y possition with an expression
on Jun 10, 2006 at 8:28:37 pm

It works great. Thanks for saving the day. But why does it work?

Like in:
[position[0],thisComp.layer("Audio Amplitude").effect("Left Channel")("Slider")]

Is it [position[0] that isolates the y axis? How would I isolate the x axis?

Thanks!!!!

Cheers!
Nick Espo


Return to posts index

Dan Ebberts
Re: Trying to animate only y possition with an expression
on Jun 10, 2006 at 8:35:23 pm

position[0] is the pre-expression x value (static value + effect of any keyframes). So this expression:

[position[0],thisComp.layer("Audio Amplitude").effect("Left Channel")("Slider")]

says - use the pre-expression x value for x and the audio amplitude for y. To keep the original y value and affect x only, you'd do it like this:

[thisComp.layer("Audio Amplitude").effect("Left Channel")("Slider"),position[1]]


Dan


Return to posts index


Nick_Espo
Re: Trying to animate only y possition with an expression
on Jun 10, 2006 at 8:41:10 pm

OK. I'll try to understand that.
Thanks for the help!
It works great.

Cheers!
Nick Espo


Return to posts index

Steve Roberts
Re: Trying to animate only y possition with an expression
on Jun 10, 2006 at 9:05:37 pm

The old long-form way of writing "position" may be instructive:

{position[0],position[1],position[2]]

... means "x position, y position, z position" for a 3D-enabled solid. If you write that (or just the two-dimensional version) then highlight "position[1]" and pickwhip to it, you're in business.

There are other ways. Search the COW for "Ebberts" as author, and copy the posts to a word processor. Dan's posts are worth saving, and he never wastes a post.




Return to posts index

Patrick ONeill
Re: Trying to animate only y possition with an expression
on Mar 8, 2018 at 3:09:24 am

Came across this old thread and posting for other who come across it.

Select the layer you want to link to another layer
Press ALT+SHIFT+= to bring up the expression
For position, you'll see something like thisComp.layer("LAYER NAME").transform.position pop up. This affects BOTH axis.

As Steve said,
position[0] = X
position[1] = Y
position[2] = Z

So, add "position[0]" to the front or "position [1]" to the back of the expression to affect only one axis.

For example, this will affect ONLY the X axis:
[thisComp.layer("LAYER NAME").transform.position[0],position[1]]
And this will affect ONLY the Y axis:
[position[0],thisComp.layer("LAYER NAME").transform.position[1]]

Hope that helps.


Return to posts index


Matt Silverman
Re: Trying to animate only y possition with an expression
on Jun 12, 2006 at 7:28:28 pm

Another solution would be to use the Transform animation preset in AE7 for "Seperate X/Y/Z". This will make you an effect with three sliders for x/y/z. Then you can link your expression to just the y slider.

-Matt


Return to posts index

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