Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Trying to animate only y possition with an expression

  • Trying to animate only y possition with an expression

    Posted by Nick Esposito on June 10, 2006 at 5:04 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

    Matt Silverman replied 19 years, 11 months ago 5 Members · 11 Replies
  • 11 Replies
  • Mylenium

    June 10, 2006 at 5:42 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

  • Dan Ebberts

    June 10, 2006 at 5:59 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

  • Nick Esposito

    June 10, 2006 at 7:24 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

  • Dan Ebberts

    June 10, 2006 at 7:53 pm

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

    Dan

  • Nick Esposito

    June 10, 2006 at 8:03 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

  • Dan Ebberts

    June 10, 2006 at 8:16 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

  • Nick Esposito

    June 10, 2006 at 8:28 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

  • Dan Ebberts

    June 10, 2006 at 8:35 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

  • Nick Esposito

    June 10, 2006 at 8:41 pm

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

    Cheers!
    Nick Espo

  • Steve Roberts

    June 10, 2006 at 9:05 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.

Page 1 of 2

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy