I'm trying to create a script in After Effects which creates some nulls and a shape layer, and applies some expressions to paths in the shape layer. This is based on the Create Paths from Nulls example script, so I've got a button that works, but it only creates the shape layer and one null. This is the code for creating the nulls:
nl = [];
for (var i = 1; i <= 4; i++) {
nl[i] = createNull(comp);
nl[i].name = ("Control-0" + i);
nl[i].label = 11; // should be orange
var np = nl[i].position;
np.setValue([100 + (i%2)*100, 100 + (Math.floor(i/2)*100)]);
var e1 = addSlider(nl[i], "CurveDepth", 1);
var e2 = addSlider(nl[i], "Roundedness", 0.5);
var e3 = addSlider(nl[i], "Influence", 1);
var e4 = addCheckbox(nl[i], "Disable", false);
}
I've also tried replacing nl[] with a standard variable in case it's the array causing the problem for some reason, but it doesn't make a difference.
On running the above code (which is a section of the code that runs when the button is pressed) I'd expect to get 4 nulls, but I only get one.
Edit: those i's were all i+1s which they didn't need to be