Hi,

I am trying to automate some animation by using a few expressions however I am struggling to make it work completely how I need it to. I have one layer that I am trying to move the position of based on the scale of another object. This I have managed to do with this expression:

a = thisComp.layer("CIRCLE_5");

[a.transform.position[0] + a.width*a.transform.scale[0]/100,value[1]] + 35;

However, where the problem starts is that I have another layer which also wants to drive the position of the first layer. I tried to use the same expression again:

b = thisComp.layer("CIRCLE_10");

[b.transform.position[0] + b.width*b.transform.scale[0]/100,value[1]] + 35;

The problem is the second one seems to deactivate the first one. I am also trying to use a Math.max expression to tell my layer to follow the layer that is biggest at the current time. For this I have been trying to use this expression:

a = thisComp.layer("CIRCLE_5");

b = thisComp.layer("CIRCLE_10");

Math.min(a,b)

This doesn't work unfortunately and I am getting very confused with it all. Essentially, if you look at the image below you will see what I am trying to achieve. The right side of the box is tied to a null and the null should always be a certain distance away from the last circle. The circles animate on with a scale up and they are all linked to each other. If there is only 3 red circles the box should be following the blue circles but if there is less blue circles then it should follow the red. Hope this makes sense.

Cheers

Rory