Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Code newb.Accordion code

  • Code newb.Accordion code

    Posted by Carly Crawford on March 8, 2011 at 7:33 pm

    So.. the effect I’m going for is an accordion in 3D space where the code is driven by the z axis of the first layer out of 10. However I don’t think I’m even saying this correctly in plain English to attempt to convert it into code.

    I’m trying to say:
    Alpha is equal to this compositions layer index 1’s z orientation
    When Alpha increases, divide it by .75
    The new variable cannot go below 0 on the z axis

    As it goes down the line I’d like index 2 to follow index 1’s orientation and index 3 to follow index 2’s orientation and so on an so forth.

    So I started:
    X=0
    Y=0
    Alpha=thisComp.Layer(1).orientation(2);
    thisLayer.orientation(2)=(Alpha/.75);

    but it says error when I put it in.. I also wonder if I’m suppose to enter this code in the orientation box too..

    Please help, frustrated and sad.

    X=0
    Y=0
    Alpha=thisComp.Layer(1).orientation(2);
    thisLayer.orientation(2)=(Alpha/.75);

    Dan Ebberts
    replied 15 years, 6 months ago
    2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    March 8, 2011 at 8:33 pm

    I don’t really understand what you’re doing, but maybe this will help. If you have a string of layers laid out end-to-end along the x axis, and you move each layer’s anchor point to its left edge and make each layer the child of the layer to its left, you can add this z rotation expression to the second layer from the left:

    -thisComp.layer(index-1).transform.zRotation*2

    and this one to all the layers to the right of that:

    -thisComp.layer(index-1).transform.zRotation

    So, all the layers except the left-most one end up with an expression. Now if you rotate the left-most layer around its z axis, you’ll get an accordion effect. It uses z rotation instead of z orientation, but the process would be similar.

    Dan

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