Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions De-synchronize Expression constraining to y axis

  • De-synchronize Expression constraining to y axis

    Posted by Xavier Corral on February 29, 2012 at 2:39 pm

    Hello All. I am currently working on a project that requires some sophisticated control. (I am going to add voiceovers) What I am doing is displaying a graphic of a basketball court. The court was created in Illustrator and pulled in as separate elements into AE. I want to have all of the components of the court fall from above the frame into the center and bounce into place one after the other. This is simple enough to do with keyframes and then moving the layers forward in time in order to achieve the one after another part. However, since I will be working with audio I would like to have a little more control. In order to this I applied the bounce keyframes to a null object and applied an expression to the other layers that I found from this tutorial (https://greyscalegorilla.com/blog/2011/03/de-sync-expressions-tutorial-by-sebastian/) The Expression goes like this

    The expression allows me to control the time it takes for the subsequent layers to bounce via a slider control on the null object. This works wonderfully! however, When I apply the expression, all of the layers fall along the same x-position. Since, as youll see in my next screenshot, I need the layers to be on different x positions I need to know what to add to this expression to extract only the y values from the null object. If you can’t tell already I am new to expressions and programming in general. So please forgive me if this is an easy question!

    Here is what the final result should look like after the bounce:

    Dan Ebberts replied 14 years, 5 months ago 2 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    February 29, 2012 at 5:41 pm

    I haven’t tested this, so there may be typos, but I think it will be like this:

    dly=thisComp.layer(“Control”).effect(“Slider Control”)(Slider”);
    y = thisComp.layer(index-1).transform.position.valueAtTime(time-dly)[1];
    [value[0],y]

    Dan

  • Xavier Corral

    March 1, 2012 at 1:05 am

    thanks for the reply! I’m away from my mac pro and don’t have the pain threshold to test it out on my 2007 macbook pro. So I will test it out at work tomorrow! I can see what’s going on here but if you have a chance could you explain this? from what I can see, you are assigning the de-sync expression to “y.”but how is that last bit work?

  • Dan Ebberts

    March 1, 2012 at 2:05 am

    Position values are just JavaScript arrays. So [value[0],y] just sets the layer’s position value to the combination of the layer’s own pre-expression x position (value[0]) with the null’s y position (y).

    Dan

  • Xavier Corral

    March 1, 2012 at 6:07 pm

    Bravo! It is close to working now! The issue I have at the present is that because the layers are following the y position (and they were drawn with perspective) they all have the exact same y value. This is a problem because each of them need to have their own y value. My thought was to find the difference between each of their pre-expression y-value and subtract it from the nulls y value. However, this does not seem to be working. I think because of the syntax, each layer is extracting the value of the layer before it and then subtracting I will demonstrate this with a screen shot below. So where in the current expression do I need to subtract the y value?

    screenshot2012-03-01at1.04.35pm.png

    the topmost expression shows me adding to the y-value. This is because the difference between this layers original y-position (744.4) and the null (482) produced a negative value, and we all know that two negatives make a positive! right?

  • Dan Ebberts

    March 2, 2012 at 4:41 pm

    If they’re evenly spaced, you should be able to calculate the y offset based on the layer’s index, something like this:

    262.4*(index-1)

    Dan

  • Xavier Corral

    March 5, 2012 at 3:48 pm

    would I add that to the end of the y=” ” line? where does the number 262.4 come from?

  • Dan Ebberts

    March 5, 2012 at 4:40 pm

    >would I add that to the end of the y=” ” line?

    Yes, it would look like this:

    y = thisComp.layer(index-1).transform.position.valueAtTime(time-dly)[1] + 262.4*(index-1);

    >where does the number 262.4 come from?

    I just grabbed it from your screen shot as an example. I have no idea what offset you would actually need there.

    Dan

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