Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions if/else as variable

  • if/else as variable

    Posted by Brian Swarthout on April 19, 2017 at 6:13 am

    Hello,

    I’m attempting to build an accordion UI element comprised of 140px tall blocks stacked onto of one another. Each “Block” is a parametric rectangle shape layer and the anchor point of the rectangle group has been moved to the top middle of the shape in order for it’s size to increase from the top of the shape. I’m using size to expand the blocks because they’re stroked.

    I’d like to have each block stick to the bottom of the block above when it scales or moves.

    I have experimented with many psuedo-solutions and believe the below will provide me the best flexibility for adding many blocks to the stack and moving them as a group. I’m only on the 2nd block and have hit a stopping point that I do not understand.

    For some reason, I’m getting an error on line 3 citing an illegal use of the the “if” statement.

    I’d love some input if someone has encountered a similar scenario before.

    aSiz = thisComp.layer("Block A").content("Block A Group").content("Block A Path").size[1];
    aPos = thisComp.layer("Block A").content("Block A Group").content("Block A Path").position[1];
    abFollo = if(aSiz>140) aSiz else aPos;

    [value[0], abFollo+140]

    Brian Swarthout replied 8 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    April 19, 2017 at 3:57 pm

    Try this instead:

    abFollo = (aSiz>140) ? aSiz : aPos;

    Dan

  • Brian Swarthout

    December 1, 2017 at 3:28 am

    Thank you!

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