Search code examples
swiftwatchkitwatchos-2

startAnimatingWithImagesInRange is not completing


I need to animate series of images.

// Animate Circle
let duration = 1.0
circleGroup.setBackgroundImageNamed("arc")
circleGroup.startAnimatingWithImagesInRange(NSRange(location: 0, length: 100), duration: duration, repeatCount: 0)

gif animation shows animated circle which animates from 0% to 45% of its radius

I have 101 images. From arc0 to arc100.

Xcode screenshot with images in the folder.

Storyboard:

storyboard with the watch app UI

As you can see on the gif, my problem is that animation doesn't make full circle trip. Any suggestion?


Solution

  • Looks like animation is stopping right after 40%. I opened asset library and renamed every file to the exactly same name. Then I opened my Git client and I saw this changes:

    Animation now works. As you can see, problem was in a file name, it had extra space in it.

    Also I learned that when doing backward animation location becomes not the starting point but the destination.