sorry for stupid question, i need to animate all sublayers in some particular layer. How to iterate through all the sublayers?
Asked
Active
Viewed 3,888 times
2 Answers
3
You can iterate sublayers of a layer via for-in loop
for child in layer.subLayers
child.animate
properties:
x: Utils.randomNumber(100)
y: Utils.randomNumber(100)
if you need an index of each sublayer, you can change loop like this
for child, i in layer.subLayers

seoh
- 353
- 1
- 13
-
Is it possible to do this recursively? – Chris Calo Apr 13 '17 at 19:12
0
I came across this question looking for a similar solution. I wanted to change all subLayers in a given layer, even deep nested layers. In the Docs I found descendants. Adding here in case someone is looking for a solution to iterate all nested subLayers.
for descendant in layers
descendant.ignoreEvents

bennewton999
- 61
- 2
- 7