Hi guys, I'm trying to add events to looped sublayers, the first 'this.children.animate' work but after I put it on Utils.delay shown error 'TypeError: undefined is not an object'.
Anyone knows how this happens and how to fix this error? 🤔
Have you tried using "delay" as part of options for this.children?
Good that you manage to fix it! Let me try and explain a bit more about what you ran into. The problem is that `this` can mean different things in each function (after an arrow).
In your case: the first one will be the same as `image` (because that’s what you tap). The second one, after the `Utils.delay` will not be image, but `window`.
There are a couple ways to fix this: you could use `image` instead of `this`, but that only works if you have only one image. A better fix is to use the double arrow (=>) instead of the single one (->) when using Utils.delay. That makes sure that `this` stays the same.