-
simplify a whole array of expressions
Hi,
I was hoping someone could help me with a expression i’m working on. I’m trying te make a message pop up box like whatsapp, if a new message pop up from below, the previous messages slide up. I use a null controller to control the y-position of all de messages ( rectangle shape layers). And this is what I have so far.As you can see, the only difference between a,b,c and so on is the index number.
I think instead of the “linear(thisComp.layer(index+X).transform…” it can be a lot shorter and cleaner, something that can look at active.layers and fill in the number automatically.I hope i’m explaining this right and someone could help me?
a = linear(thisComp.layer(index+1).transform.scale[1],0,100,transform.yPosition,transform.yPosition-thisComp.layer(index+1).content("Rectangle 1").content("Rectangle Path 1").size[1]);
b = linear(thisComp.layer(index+2).transform.scale[1],0,100,transform.yPosition,transform.yPosition-thisComp.layer(index+2).content("Rectangle 1").content("Rectangle Path 1").size[1]);
c = linear(thisComp.layer(index+3).transform.scale[1],0,100,transform.yPosition,transform.yPosition-thisComp.layer(index+3).content("Rectangle 1").content("Rectangle Path 1").size[1]);
d = linear(thisComp.layer(index+4).transform.scale[1],0,100,transform.yPosition,transform.yPosition-thisComp.layer(index+4).content("Rectangle 1").content("Rectangle Path 1").size[1]);
e = linear(thisComp.layer(index+5).transform.scale[1],0,100,transform.yPosition,transform.yPosition-thisComp.layer(index+5).content("Rectangle 1").content("Rectangle Path 1").size[1]);z= [a+b+c+d+ e];
z
Always learning