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;
aPos = thisComp.layer("Block A").content("Block A Group").content("Block A Path").position;
abFollo = if(aSiz>140) aSiz else aPos;