-
Looking for a better way for write this.
So i have these rectangles i want to make up the days of a Calendar with. I have a top “Controller” null layer with some x and y offset sliders for the gap between the rectangles and using the index-1 method to distribute them. But obviously a calendar isnt a straight horizontal row of days. I remember seeing a grid code by Dan a while back that may work, but thats a little more complex for me at the moment. I wrote this code that actually does exactly what i want it to, but i think it may be kind of a crude way of accomplishing it and im sure theres a better cleaner way out there. For instance i was trying to figure out how to make every 7th layer move down on the Y without having to create a separate variable for each row, played around with “++*7” on my one variable but wasnt doing it. But if anyone can take my code and clean it up, introduce some new methods to me i think it would be a good learning process, thanks a lot :).
i1 = thisComp.layer("calendar shape").index+7;
i2 = thisComp.layer("calendar shape").index+14;
i3 = thisComp.layer("calendar shape").index+21;Ci = thisLayer.index;
x1 = thisComp.layer(index-1).transform.position[0]+thisComp.layer("controller").effect("xOffset")("Slider");
x2 = thisComp.layer("calendar shape").transform.position[0];y1=thisComp.layer(index-1).transform.position[1];
y2=thisComp.layer(index-1).transform.position[1]+thisComp.layer("controller").effect("yOffset ")("Slider");z=thisComp.layer(index-1).transform.position[2];
r1 = [x1,y1,z];
r2 = [x2,y2,z];if(Ci==i1||Ci==i2||Ci==i3){r2
}else{
r1
}