Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expression for Y-value position movement

  • Expression for Y-value position movement

    Posted by Joe Pascale on January 5, 2009 at 8:00 pm

    Hi,

    I’ve been using AE for a few years now, but I am admittedly a noob when it comes to expressions. I’ve searched the forums for a while now and cant find any posts that answer my question, which is this:
    Is there a simple expression to apply to the Y-value of an object so that it just goes up and down at equal intervals each time? I know you can apply the wiggler to affect only the y-axis, but the jump is too random each time and I need it to be consistent.

    Thank you kindly,
    j

    Ian Brown replied 4 years, 3 months ago 6 Members · 9 Replies
  • 9 Replies
  • Andy Devries

    January 5, 2009 at 8:43 pm

    If it’s a constant looping interval, I suppose I’d animate a null object with the desired y-axis movement, loop it using time remap, and parent it to the position property of the object.

  • Joe Pascale

    January 5, 2009 at 8:58 pm

    Hi Andy,

    Thanks for the response. I kind of don’t want to use nulls because i don’t want to clutter my work space (i know i could hide them using shy layers). I just wonder if there is a simpler way to do this with an expression…..

    j

  • Josh Weiss

    January 5, 2009 at 9:51 pm

    I am not an expression wizard, but you can do the same thing without the use of a null. Basically, if you don’t have any other position animation on the layer you can animate the position of the layer in only the y position and then apply this expression (only the part in quotes) “loopOutDuration(type = “pingpong”, duration = 0)” What this does, is takes two or more keyframes (that should start at the beginning of your timeline) and loops them for the duration of your project. If you have other position animation that you have to worry about you can do it other ways. You can put a transform effect on the layer, and then animate the position on that in just the y and put the same expression on that. This basically acts as a null without having to have a null. Or if this is the only y position animation you have and you are in CS3, you can search for an effect called separate x, y, z. What this does is break down x, y, and z into separate effect controllers so they can be keyframed independently. Then you can put the y animation on the y property with that expression and animate the x and z separately. If you are in CS4, there is a switch to treat x, y, z as separate keyframable items without the need for this effect. If you don’t understand this, let me know. I know it was a lot to throw at you. Oh also, the expression above will go from point a to point b back to point a so it will animate for instance up to down to back up. If you want to just jump from B back to A at the end of the two keyframes, you just change the word pingpong to cycle. Its hard to illustrate by describing it, but if you test it you will see what i mean.

  • Jan Sherlink

    January 5, 2009 at 10:27 pm

    try this in position;

    radius= 100;
    angle=time*1;
    y=radius*Math.cos(angle);
    [value[0],value[1]+y]

    cya,

    Jan

  • Joe Pascale

    January 5, 2009 at 10:39 pm

    Thanks for all the replies. Jan, that expression did the trick perfectly – just tweaked the numbers to control it to my liking. Well awesome! Josh, I tried your method and kept getting errors, probably my own ineptitude though.
    Thanks again for all the help!
    Cheers,
    joe

  • Manojit Ghose

    December 5, 2012 at 11:25 am

    Hi Jan,

    i got stuck into something similar, and your script is almost helpful…it would do me a ton of help if you could tell me if there is a way to make this expression to animate the x position of a layer/null by a given pixel value during the duration(in and out) of the layer

    thanks
    m

    MG

  • Jan Sherlink

    December 6, 2012 at 8:37 am

    something like this ?

    xmove=500;
    pos1=value;pos2=add(value,[xmove,0]);
    linear(time,inPoint,outPoint,pos1,pos2)

    cya,
    Jan

    cya,

    Jan

  • Manojit Ghose

    December 6, 2012 at 9:01 am

    absolutely exactly what i was seeking! 🙂
    thanks a ton!

    manojit

    MG

  • Ian Brown

    January 28, 2022 at 5:18 pm

    <div>Trying to wrap my head around this expression, for one thing I don’t understand why you multiply “time*1”
    </div><div>

    Its clear I’m missing something but isn’t anything *1 essentially the same number (with or without that multiplication)?

    </div>

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