Apologize for bombarding your facebook group with more than one questions a day. But I have been trying to interate through subLayers using a loop:
for child in layer.subLayers child.states.animationOptions = delay: (child.index + 1)/50
However, the problem is that the loop counts in reverse! Meaning the last layer has index of 0 and this is really messing up my animation.
I tried looking for a sketch plugin that reordered all my layers in reverse but failed. I hope there is a way to do that without reordering manually.
Thank you very much!
for counter, layer of layer.subLayers ...
Could you please clarify what you mean? I solved this problem by doing a "trick" to my formula.
delay: (cities.subLayers.length - (child.index + 1))/30
Not ideal, but it did the job. Curious to see a better way. Thanks!
So for...of is a coffee script way of getting a counter _and_ item from a list. The layer.index is reverse, but the counter is not.